Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all 13329 articles
Browse latest View live

Duplicating an Entry

$
0
0
Hi All,

I work in a hospital and I have a database that is used by the departments to request additions and changes to their charges for their respective areas.

We are converting to a new system and with that new system need to add the same charge to multiple departments all at the same time. I am trying to figure out a way for the department to enter the charge request/change 1 time but have it affect all the various departments.

For example. If they add a request for Physical Therapy, I would want the 1 request to filter into 7 different departemtns or cost center numbers.

I was able to do it using a query but that only works in the query it wouldn't actuall save the duplicate records to the main table.

Is there a way to have the entry of a single record duplicate into the same table automatically?

I hope I explained this well enough to get an answer.

Join Query Not working

$
0
0
I have two tables “tblAssets” and “tblMaintContracts”, which I need to query to get only the assets with maintenance contracts. I am getting Runtime error ‘3075’: Syntax error in query expression.
This is my code:

Dim strSQL As String

'Display only assets (equipment) with maintenance contracts
strSQL = "SELECT tblAssets.* " & _
"INNER JOIN tblMaintContracts.* " & _
"ON tblAssets.AssetId = tblMaintContracts.AssetId;"

‘populate form with recordset
Form_frmAssetsContracts.RecordSource = strSQL

Do you see anything askew?
Thanks for your help.

help with multi-case query

$
0
0
If I have the following query:

select distinct TO_CHAR(ARCHIVE_DATE, 'mm/dd/yyyy') as "Date"
,CASE APS_RULE_ID WHEN '67.2' THEN count (distinct (APS_TX_ID)) END as "Rule 67.2"
--
,CASE APS_RULE_ID WHEN '34.4' THEN count (distinct (APS_TX_ID)) END as "Rule 34.4"
,CASE APS_RULE_ID WHEN '34.2' THEN count (distinct (APS_TX_ID)) END as "Rule 34.2"
,CASE APS_RULE_ID WHEN '34.0' THEN count (distinct (APS_TX_ID)) END as "Rule 34.0"
,CASE APS_RULE_ID WHEN '162.1' THEN count (distinct (APS_TX_ID)) END as "Rule 162.1"
,CASE APS_RULE_ID WHEN '162.2' THEN count (distinct (APS_TX_ID)) END as "Rule 162.2"
,CASE APS_RULE_ID WHEN '162.3' THEN count (distinct (APS_TX_ID)) END as "Rule 162.3"
,CASE APS_RULE_ID WHEN '162.4' THEN count (distinct (APS_TX_ID)) END as "Rule 162.4"
,CASE APS_RULE_ID WHEN '162.5' THEN count (distinct (APS_TX_ID)) END as "Rule 162.5"
,CASE APS_RULE_ID WHEN '162.6' THEN count (distinct (APS_TX_ID)) END as "Rule 162.6"
,CASE APS_RULE_ID WHEN '166.0' THEN count (distinct (APS_TX_ID)) END as "Rule 166.0"
,CASE APS_RULE_STATUS WHEN 'Limited' THEN count (distinct (APS_TX_ID)) END as "Rule 44.0 Limited Risk"
,CASE APS_RULE_STATUS WHEN 'Moderate' THEN count (distinct (APS_TX_ID)) END as "Rule 44.0 Moderate Risk"
,CASE APS_RULE_STATUS WHEN 'High' THEN count (distinct (APS_TX_ID)) END as "Rule 44.0 High Risk"
from ARCHV_SCORE_RESULT
Where ARCHIVE_DATE > to_date('04-29-2013 23:59:00','mm-dd-yyyy hh24:mi:ss')
and APS_RULE_STATUS != 'Pass'
Group by TO_CHAR(ARCHIVE_DATE, 'mm/dd/yyyy'), APS_RULE_ID, APS_RULE_STATUS
Order by "Date" DESC;


and if I currently get a record set with multiple rows for each date with sum count total in each particular rule column, and null values in the rest of the columns, how can I get one record per actual date with sum count totals for every rule included across the board??

Any help would be greatly appreciated??

Thank you,

Patrick Q

to edit global variable

$
0
0
Another question James. Can you tell me how can I edit an global variable .
It is very easy to edit or to change a local variable into global but it s different for an global variable.

Log the Informix database SQL operation

$
0
0
Hi
I am a beginner for informix database. I need to track and record the changes for specific informix tables by an database operator. What technique is readily available to record the various transactions on the selected informix tables.
Please suggest the technique. Thanks in advance.
best regards,
Venkatesh

Oracle client driver version compatibility issue

$
0
0
Which Oracle client version is compatible to install on Windows Server 2008 R2 (6.1) to access Oracle 8i (8.0) database?

My problem is that I can not upgrade Oracle server database and I am looking some solution that work on current setup.

Oracle Server Database: Oracle 8i
Client – Windows Server 2008 R2 (6.1)
I want OLE DB, ODBC and client so please suggest some alternate way to work around this.

SQL help-Period names on columns.

$
0
0
Hello to all. I need some help on SQL as I’m new to it. I have the following two tables:
AMOUNTS (a)
Account_ID
Period_name
Amount

ACCOUNTS (b)
Acount_ID

By using the following SQL query:
Code:

SELECT b.Account_ID , SUM(a.Amount), a.Period_name
FROM AMOUNTS a, ACCOUNTS b
WHERE a.Account_ID = b.Account_ID
GROUP by b.Account_ID,a.Period_name

I get
Account_ID SUM(Amount) Period_name
XXXXX XXXXX AAAAA
XXXXX XXXXX BBBBBB

How can I get?
Account_ID AAAAA BBBBB
XXXXXX XXXXX XXXXX

Thanks in advance for any kind help.
Octavio

java.sql.SQLException: JZ0C0: Connection is already closed.

$
0
0
Hi,

We get java.sql.SQLException: JZ0C0: Connection is already closed.
This error is occurred in a rare case(may be once in 2 months), due to which the log file grow in GB's.

And after the above error, log file shows thousands of below lines
-ERROR- JDBCDatabase.getObjectField: No fields can be returned from this method because no query results exist to be retrieved. A query must first be executed through t
his class and then the get method must be called to reference a row of the query results before this method can be called.

Please help, what are the possible solutions can be apply to avoid such kind of error OR to avoid growing of log file in this case

Thanks,
Sushanth

Oracle 9i\10.1,10.2 instant client on Windows server 2008 R2(6.1)

$
0
0
Hi All,
I checked and found that we can not install 9i or 10g client\ODBC on Windows Server 2008 R2 (6.1) but just want to check if any option is there to get this done.


Thanks in advance!

Query: IF date = current month, sum sales, 0) How do I make this work?

$
0
0
I have a query that I need three columns One for this month, last month and 2 months ago. Instead of using a crosstab query I want to put this into a regular query.

I figure the formula would work something like this

IIF(Date = current month, sum(sales),0) Im not sure how to make the date=current month part work.

ACCESS 07 Report won't open

$
0
0
I built a database on my company network that only I use.

I've got a report, mrSO, I open with query defs in an onclick, cmdOUT
I run this everyday - until last Thursday when I did compact & repair before I closed out.
This report won't open anymore. Can anyone suggest what may have happened as the code was not changed at all? I ran analysis and compiled code but neither worked?
Here's the code...........
command button:
Code:

Private Sub cmdOUT_Click()
Dim DB As DAO.Database
Dim QDF1 As QueryDef
Dim where As Variant

Set DB = CurrentDb()

On Error Resume Next
DB.QueryDefs.Delete ("GoalsA")
On Error GoTo 0

where = where & " AND (IsNull([Unapplied]))"
where = where & " AND ([Salesrep1] Like '*" & [txtWCIGslmn] & "*' OR [SLMN2] Like '*" & [txtWCIGslmn] & "*' OR [SLMN3] Like '*" & [txtWCIGslmn] & "*')"
where = where & " AND ([BAL] Is Null OR [BAL] > 0)"
where = where & " AND ((([DUE]>Date())=0))"
where = where & " AND (IsNull([ICID]))"


Set QDF1 = DB.CreateQueryDef("GoalsA", "Select * From qryMainReport1" & (" where " & Mid(where, 6) & ";"))
DoCmd.OpenReport "mrSO", acViewPreview


End Sub

I know that the onclick is working because DoCmd.OpenReport is triggering...if you see below I have a function Report_Open that opens 2 queries. Those open, then access shows Formatting and Running Query at bottom right, but the report mrSO doesn't open......the 2 queries close and then I'm back to my form with cmdOUT?

I can't identify why there is a hangup now when it tries to open, and why it is jumping to Report_Close which triggers the queries to close?

Any suggestions to fix or change would be greatly appreciated! (Although, this worked for me as is since I created it)

report:
Code:

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
    If Me.srFAKES.Report.HasData Then
        Me.srFAKES.Visible = True
        End If
            If Me.SlmnOutstandingCM.Report.HasData Then
                Me.SlmnOutstandingCM.Visible = True
                End If
     
End Sub
               
   
Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
    If Me.srCPO.Report.HasData Then
        Me.srCPO.Visible = True
        Else
        Me.srCPO.Visible = False
        End If
            If Me.srNOTES.Report.HasData Then
            Me.srNOTES.Visible = True
            Else
            Me.srNOTES.Visible = False
            End If
                If Me.Slmn_OutstandingCI.Report.HasData Then
                Me.Slmn_OutstandingCI.Visible = True
                Else
                Me.Slmn_OutstandingCI.Visible = False
                End If
                    If Me.SlmnOutstandingCO.Report.HasData Then
                    Me.SlmnOutstandingCO.Visible = True
                    Else
                    Me.SlmnOutstandingCO.Visible = False
                    End If
End Sub

Private Sub Report_Close()
DoCmd.Close acQuery, "TotalsA"
DoCmd.Close acQuery, "GrandTotalsA"
End Sub

Private Sub Report_Open(Cancel As Integer)
Dim DBSO1 As DAO.Database
Dim DBSO2 As DAO.Database
Dim QSO1 As QueryDef
Dim QSO2 As QueryDef
Dim where As Variant

Set DBSO1 = CurrentDb()
Set DBSO2 = CurrentDb()

On Error Resume Next
DBSO1.QueryDefs.Delete ("TotalsA")
DBSO2.QueryDefs.Delete ("GrandTotalsA")
On Error GoTo 0

where = where & " AND ([Salesrep1] Like '*" & [Forms]![WCIGChooser]![txtWCIGslmn] & "*' OR [SLMN2] Like '*" & [Forms]![WCIGChooser]![txtWCIGslmn] & "*' OR [SLMN3] Like '*" & [Forms]![WCIGChooser]![txtWCIGslmn] & "*')"
where = where & " AND ((([DUE]>Date())=0))"

Set QSO1 = DBSO1.CreateQueryDef("TotalsA", "Select * From qryMainReport2" & (" where " & Mid(where, 6) & ";"))
DoCmd.OpenQuery "TotalsA"
Set QSO2 = DBSO2.CreateQueryDef("GrandTotalsA", "Select * From qryMainReport2" & (" where " & Mid(where, 6) & ";"))
DoCmd.OpenQuery "GrandTotalsA"
End Sub

DB2 KERBEROS Setup on Windows using Windows AD as KDC

$
0
0
Hello,

I have done db2 kerberos setup on windows using Windows AD as KDC. I am able to connect from windows client to windows server using Kerberos. But When I connect from linux client to Windows server getting below mentioned error. Please throw some light on this.

Find the configurations below.

DB Server:
OS: Windows 2008 R2
db2level: DB2 V10.1 FP2

dbm cfg:
Client Userid-Password Plugin (CLNT_PW_PLUGIN) =
Client Kerberos Plugin (CLNT_KRB_PLUGIN) = IBMkrb5
Group Plugin (GROUP_PLUGIN) =
GSS Plugin for Local Authorization (LOCAL_GSSPLUGIN) =
Server Plugin Mode (SRV_PLUGIN_MODE) = UNFENCED
Server List of GSS Plugins (SRVCON_GSSPLUGIN_LIST) =
Server Userid-Password Plugin (SRVCON_PW_PLUGIN) =
Server Connection Authentication (SRVCON_AUTH) = NOT_SPECIFIED
Cluster manager =

Database manager authentication (AUTHENTICATION) = KERBEROS
Alternate authentication (ALTERNATE_AUTH_ENC) = NOT_SPECIFIED
Cataloging allowed without authority (CATALOG_NOAUTH) = NO
Trust all clients (TRUST_ALLCLNTS) = YES
Trusted client authentication (TRUST_CLNTAUTH) = CLIENT
Bypass federated authentication (FED_NOAUTH) = NO

DB Clients:
from Windows client machine, I am able to connect to database using Kerberos. But from linux I am not.

OS: Linux RHEL 6.4
I have installed DB2 V10.1 FP2 client and cataloged the database.
I am able to do kinit for the id which is there on Windows AD. But when I connect to db it says,

SQL30082N Security processing failed with reason "36" ("UNEXPECTED CLIENT
ERROR"). SQLSTATE=08001

from db2diag.log:
2013-08-21-17.46.17.155998+330 E563376E524 LEVEL: Severe
PID : 25544 TID : 139909521442592 PROC : db2bp
INSTANCE: db10inst NODE : 000
HOSTNAME: IRL64PPD31
FUNCTION: DB2 UDB, bsu security, sqlexSlcGssPluginSecchk, probe:200
MESSAGE : ADM13000E Plug-in "IBMkrb5" received error code "851968" from the
GSS (Generic Security Service) API "gss_init_sec_context" with the
error message "Unspecified GSS failure. Minor code may provide more
information".

2013-08-21-17.46.17.156150+330 E563901E490 LEVEL: Severe
PID : 25544 TID : 139909521442592 PROC : db2bp
INSTANCE: db10inst NODE : 000
HOSTNAME: IRL64PPD31
FUNCTION: DB2 UDB, bsu security, sqlexSlcGssPluginSecchk, probe:200
MESSAGE : ADM13000E Plug-in "IBMkrb5" received error code "-1765328377" from
the GSS (Generic Security Service) API "gss_init_sec_context" with
the error message "Server not found in Kerberos database".

dbm cfg from client:
Client Userid-Password Plugin (CLNT_PW_PLUGIN) =
Client Kerberos Plugin (CLNT_KRB_PLUGIN) = IBMkrb5
Group Plugin (GROUP_PLUGIN) =
GSS Plugin for Local Authorization (LOCAL_GSSPLUGIN) =
Server Plugin Mode (SRV_PLUGIN_MODE) = UNFENCED
Server List of GSS Plugins (SRVCON_GSSPLUGIN_LIST) =
Server Userid-Password Plugin (SRVCON_PW_PLUGIN) =
Server Connection Authentication (SRVCON_AUTH) = NOT_SPECIFIED
Cluster manager =

Database manager authentication (AUTHENTICATION) = KERBEROS
Cataloging allowed without authority (CATALOG_NOAUTH) = YES
Bypass federated authentication (FED_NOAUTH) = NO

krb5.conf from Linux client machine.

$ cat /etc/krb5.conf
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log

[libdefaults]
default_realm = <realm name>
dns_lookup_realm = false
dns_lookup_kdc = false
ticket_lifetime = 24h
renew_lifetime = 7d
forwardable = true

[realms]
Original REALM = {
kdc = <servername>.<realm name>
admin_server = <servername>.<realm name>
}

[domain_realm]
.<realm name in small letters> = <realm name>
<realm name in small letters> = <realm name>

[appdefaults]
pam = {
debug = false
ticket_lifetime = 36000
renew_lifetime = 36000
forwardable = true
krb4_convert = false

Do we have to do any mapping in Windows AD to linux client machine. Please share your thoughts. Thank you.

Some cool examples files Parte II

$
0
0
I saw here a lot of a cool examples files in Brilliant Database beyond the imaginations of Mikhail examples.

If some one have an file and want to share, it will be very apreciate if put attached in this topic. Even one was posted before.

Please, post a your name, name of the appbdb and a simple description.

Christian

Hello from Kansas

$
0
0
First post here. I'm not sure the forum is an appropriate place to ask what I want to ask. The description of this part of the forum says this is a place to ask questions without getting flamed so here goes.

I'm wanting to find someone to build a simple database and web based UI for me preferably using PostgresQL. It's not going to be a huge project but I do want it done right so it would be ideal for a gifted college student needing some cash or a side job for a professional.

I currently have a set of spreadsheets I use to manage my business. When I enter data in to one spreadsheet, I have to enter the same data in at least 2 other spreadsheets. There are also manual calculations I make every time in the first spreadsheet that could surely be automated somehow. It is tedious and I would prefer to automate things a bit more.

Most of the jobs posted in the Jobs section are much more in depth and are full time opportunities. I feel like there is a good chance something like this would not be seen by people who might be interested in that location. Is there some place on this or another forum where it might get the type of traffic that would result in me finding someone suitable? Thanks.

SQL6031N Error in the db2nodes.cfg file at line number "1". Reason code "10"

$
0
0
Hi all,

I got this error; and followed the instructions in this technote: IBM Changing hostname of the DB2 server - United States (Seems to me that technote may be for pre-v10.)

Anyway, I am still getting the above error when I issue a db2start,
even though I have the hostname in db2nodes.cfg, /etc/HOSTNAME, /etc/hosts AND DB2SYSTEM set to the same name. The name is an alias for the complete name (x.y.com).

db2licm -l shows:
Product name: "DB2 Advanced Enterprise Server Edition"
License type: "Authorized User Single Install"
Expiry date: "Permanent"
Product identifier: "db2aese"
Version information: "10.5"
Enforcement policy: "Soft Stop"
Number of licensed authorized users: "25"

db2level does not run. I get
SQL10003C There are not enough system resources to process the request. The request cannot be processed.

I am using a Linux SUSE 64-Bit VM image. I checked, I have enough memory and storage. All was right until I changed the hostname.

Thanks.

label execution regardless of GOTO

$
0
0
This seems so at odds with SQL08R2 BOL that I must be missing something obvious. I'm trying to use GOTO for the first time for a quick error check, but the label is executing regardless of the GOTO statement.

For instance:

Code:

print 'I am above the GOTO call.'
if 0=1
begin
    GOTO I_SHOULD_NEVER_RUN
    print 'I should never run'
end
print 'I am below the GOTO call.'

I_SHOULD_NEVER_RUN: print 'I seem to run just from being in this batch.'
GO

returns:

I am above the GOTO call.
I am below the GOTO call.
I seem to run just from being in this batch.


My understanding was that anything with the colon was a label and thus ignored unless specifically directed via GOTO. So why is the label executing? I've tested this in mssql2k with the same results, so I must be missing something obvious with the label syntax.

resurrecting Old informix instant

$
0
0
I am really new to this informix and running IDS 7.3 on a SCO 5.4

we are having a ole informix instant which we did not used for a long time and and there is change request from one of our customer and forced to resurrect this instant.

On this machine there has been a hd failure and was replaced with a new one loosing root dbspace. I dont need to recover any of the databases but if some one can give me some help on host reinitialize (start from the beginning with out reinstalling) everything and start new would be appreciated

Thanks and Regads

time command

$
0
0
Can you pls any one explain the below command.

FTPLOADFILE="$HOME/tmp/loadfile"
LOADFILE="loadfile"
STRUCTURE="$PROJ/include/orders.h"
DICTIONARY=PROJ/data/Process.dictionary
PGM="samp.load.SampStatus"
JAVA="java -Xms512M -Xmx1024M"

time $JAVA $PGM -s $STRUCTURE -i $FTPLOADFILE -o $LOADFILE -p $DICTIONARY

OUTPUT INSERTED INTO can't get column value when that column is not inserted

$
0
0
Hi,

I'm doing a data migration job from our old to our new database. The idea is that we don't want to clutter our new tables with the id's of the old tables, so we are not going to add a column "old_system_id" in each and every table that needs to be migrated.

I have created a number of tables in a separate schema "dm" (for Data Migration) that will store the link between the old database table and the new database table. Suppose that the id of a migrated record in the old database is 'XRP002-89' and during the insert into the new table the IDENTITY column id gets the value 1, the link table will hold : old_d = 'XRP002-89', new_id = 1, and so on.

I knew I can get the value of IDENTITY columns with the OUTPUT INTO clause, although I have never actually used it. And now I can't get it to do what I need.

Below is some code to set up three tables: the old table, the new one, and the table that will hold the link between the id's of records in the old database table and the new database table.
Code:

CREATE TABLE DaOldTable(
        pk                CHAR(10)        NOT NULL,
        a_column        CHAR(10)
)

CREATE TABLE DaNewTable(
        id                INT        NOT NULL        IDENTITY,
        a_column        CHAR(10)
)

CREATE TABLE link_old2new_DaTable(
        DaOld_id        CHAR(10)        NOT NULL,
        DaNew_id        INT        NOT NULL
)

INSERT INTO DaOldTable(pk, a_column) VALUES
('1st rec', 'first rec'),
('2nd rec', 'second rec'),
('Nth rec', 'last rec')

SELECT * FROM DaOldTable
--pk                a_column
--1st rec        first rec
--2nd rec        second rec
--Nth rec        last rec

Below I tried to use the OUTPUT INSERTED INTO clause. Beside getting the generated IDENTITY value, I also need to capture the value of the old id that will not be migrated to the new table. When I use "OUTPUT DaOldTable.pk" the system gives me the error: "The multi-part identifier "DaOldTable.pk" could not be bound." Using INSERTED .id gives no problem.
Code:

INSERT INTO DaNewTable(a_column)
--OUTPUT DaOldTable.pk, INSERTED.id link_old2new_DaTable--(DaOld_id, DaNew_id)
SELECT a_column
FROM DaOldTable

SELECT * FROM DaNewTable
--id        a_column
--1        first rec
--2        second rec
--3        last rec 

SELECT * FROM link_old2new_DaTable
--Expected result in link_old2new_DaTable
--DaOld_id        DaNew_id
--1st rec        1
--2nd rec        2
--Nth rec        3

--but getting "The multi-part identifier "DaOldTable.pk" could not be bound."

DROP TABLE DaOldTable
DROP TABLE DaNewTable
DROP TABLE link_old2new_DaTable

How can I populate a table that must hold the link between the id's of records in the old database table and the new database table? The records are migrated with set-based inserts.

Missing something very basic?

$
0
0
I have a command button on a (Contacts) form, to open a second form and apply the ContactID of the current record to that form. It seems okay if there are no existing records already assigned to that particular ContactID, as it opens to a new record in the second form, with the ContactID already populated. However, when a contact already has an associated record in the second form, it opens to that record, instead of a new record. What am I missing? I hasten to add I am completely new to databases and coding etc., so I'm learning as I go.

My code is as follows:

'Open the enquiry form and enter data for this person.

If Not IsNull(Me.ContactID) Then
DoCmd.OpenForm "frmEnquiry", , , , , , Me.ContactID
End If
DoCmd.OpenForm "frmEnquiry", , , "ContactID=" & Me.ContactID

Is there a way to get the second form to always open to a new record for the current contact, even if a contact already has other 'contact events' existing in the Enquiry table?

Also, if a user tries to open the second form without first entering contact details, is there a way to cancel the action and advise that they must be on an existing record for this button to operate?

Hope this makes sense!

Many thanks.
Viewing all 13329 articles
Browse latest View live


Latest Images