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

Logshipping Issue

$
0
0
Hello,
We are having an issue that Log shipping have set up a every 15 minutes but looks like table records are not matching, it's always some of the records difference.
Could you please suggest?

Thanks,

Reorg LOB column

$
0
0
Environment Details:
Version DB2 V9.5 FP 4
Single partitioned


We have a table in which a column's datatype is defined as CLOB. I need to perform offline reorg on the table. Do I need to mention any option with reorg command so that it performs the reorg on the CLOB column ? Or just the normal reorg command would take care of LOB data too ?

9.7 function create problem

$
0
0
I'm trying to create this function in Control Center, but having some problems with the syntax:

Code:

CREATE FUNCTION findMax (tablename VARCHAR(64), columnname VARCHAR(255))
RETURNS INTEGER
LANGUAGE SQL
NO EXTERNAL ACTION
BEGIN ATOMIC
RETURN
SELECT MAX(columnname) FROM tablename;--
END;


DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0204N "DB2ADMIN.TABLENAME" is an undefined name. LINE NUMBER=6.
SQLSTATE=42704

SQL0204N "DB2ADMIN.TABLENAME " is an undefined name.

remove constraints on db2 table

$
0
0
Hi All,

Can anyone help ,how we can remove constraints on table,

Below are error message,

DELETE FROM DB2.CHNG_EVNT_ITM;
SQLERROR ON DELETE COMMAND, EXECUTE FUNCTION
RESULT OF SQL STATEMENT:
DSNT408I SQLCODE = -532, ERROR: THE RELATIONSHIP CCHEID02 RESTRICTS THE DELETI
DSNT418I SQLSTATE = 23504 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNXRSDL SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = -190 13172769 0 13228485 -742129664 0 SQL DIAGNOSTIC
DSNT416I SQLERRD = X'FFFFFF42' X'00C90021' X'00000000' X'00C9D9C5' X'D3C
INFORMATION

HADR Sync

$
0
0
RHEL 6.2 - DB2 9.5 FP 8.

Is there a way to find out if the 2 HADR databases (Primary and Standby) are in sync without failing over ?

Thank you.

performance when using LOBs

$
0
0
Hi all,
I'm using DB2 10.1 ESE on Windows.

I'm having very poor performances with a select with a join on a table with a BLOB column.
The column is defined as BLOB(2G) and contains text in binary string that is retrieved and parsed by a function.
The select is

select P.uid, CAST( fn_parse( 'any string', P.Data ) AS integer) AS outID
from DATAT P, LOCATIONS V, SUPERSID S
where P.uid = V.uid
and CAST( fn_parse( 'any string', P.Data ) AS bigint) = S.buid
and fn_parse( 'any string', P.Data ) IS NOT NULL

In a unit test I created another table DATAT1 where the Data column is varchar(8000) for bit data and rewrote fn_parse to accept varchar for bit data instead of BLOB(2G). I used a subset of real data for the unit test and the result was a great performance improvement.

I cannot use varchar for bit data in production since I have fields that can be very large and cannot be accomodated in a varchar column.

Could you please suggest the best strategy to solve this issue?
How can I optimize performance for a select on LOBs?

Many thanks

Grouping in DB2

$
0
0
I have a problem. This is how my fields are displayed.

Customer amt expense expkey seqno
ATT 20 TEL 1 1
BBB 66 SER 2 1
BBB 66 SER 2 2
CCC 40 DOG 1 1
CCC 40 SER 1 1

What I am looking for is an SQL that will return the all the records (should'nt filter any) but for each group of customer with the same expkey it will return the max value for the seqno. Therefore the results would look like this

customer amt expense expkey max(seqno)
ATT 20 TEL 1 1
BBB 66 SER 2 2 (note how this displays the max )
BBB 66 SER 2 2
CCC 40 DOG 1 1
CCC 40 SER 1 1

The query that I tried it filters out the row - see below

select max(seqno), customer,amt,expense,expkey
from cust
group by customer, amt,expense,expkey

Can someone please assist me with putting together a proper query to reflect what I am looking for.

Thanks

CTE ResultSet counts vary

$
0
0
Hey everyone,
I have the below CTE that I just can't seem to get to give me the right results. Basically what im trying to do is use the first query to show the "sources" that are involved in each inquiry and the second query to show which of those have became "admissions" the thing is the counts of the sources when the CTESource query is ran alone is different than my query to join the two tables. Any help would be great;
Code:

With CTESource(Total, ID, Source, Program) AS
(
        SELECT count(Inquiry.ID) as Total, Referral.InquiryID_fk, Source, Inquirer.Program from Referral
        Inner Join Inquiry on Inquiry.ID = Referral.InquiryID_fk
        Inner Join Inquirer on Inquirer.ID = Inquiry.InquirerID_fk
        left join DecAdmit on DecAdmit.InquiryID_fk = Referral.InquiryID_fk
        WHERE (Inquiry.Date >= '3/1/2012' AND Inquiry.Date <= GetDate()) AND
        (Inquiry.DecisionMade = 'Decision to admit') AND Inquirer.Program IN('Appleton','Brook','Fernside','Gunderson','Hill Center','Lincoln','OCDI','Pavilion','Res. Referral Coord.')
        Group By Source, Program, Referral.InquiryID_fk
)
, CTEAdmission(Total, ID, Source, Program) AS
(
        SELECT count(DISTINCT Referral.InquiryID_fk) as Total, Referral.InquiryID_fk, Source, Inquirer.Program from Referral
        Inner Join Inquiry on Inquiry.ID = Referral.InquiryID_fk
        Inner Join Inquirer on Inquirer.ID = Inquiry.InquirerID_fk
        left join DecAdmit on DecAdmit.InquiryID_fk = Referral.InquiryID_fk
        WHERE (Inquiry.Date >= '3/1/2012' AND Inquiry.Date <= GetDate()) AND
        (Inquiry.DecisionMade = 'Decision to admit') AND (DecAdmit.ActualAdmitDate <= GetDate()) AND Inquirer.Program IN('Appleton','Brook','Fernside','Gunderson','Hill Center','Lincoln','OCDI','Pavilion','Res. Referral Coord.')
        Group By Source, Program, Referral.InquiryID_fk
)
SELECT
A.Program, A.Source , count(A.Total) as SourceCount, IsNull(B.Total,0) as Admissions from CTESource A
left outer join CTEAdmission B on A.ID = B.ID
Group By A.Program,A.Source,  B.Total


What I want to do is connect the totals by program so that in my ReportBuilder report I can show the 0 results. Something like this;

Code:

Source:            Program1            Program2          Program3
Source 1              5                  7                  0
Source 2              0                  4                  2
Source 3              1                  0                  3
Total Inquiries      10                  11                  8
Total Admission        7                  5                  0

The total inquiries can be higher than the source totals since a source isnt required in the system as well as there does not have to be admissions regardless of inquiry count.

Thank you all for taking the time to look into this, i hope it isn't too confusing.

Stored procedures

$
0
0
Hi,
I am somehow new to Mysql and I have 2 questions that I would be grateful if anyone answered:
1. What are the internal (systematic) Stored Procedures in Mysql? (in MSSQL we have lots of them but I have not seen any for Mysql)
2. Do systematic Stored Procedures in Mysql get inputs from users?

Thanks

New here - Student

$
0
0
Hey all,
The site looks great,

I joined this forum as I have only started to learn ER models. and phpmyadmin / php /mysql

I am wondering would it be possible for me to post project Im doing for any tips/help.

It will gain me no marks, it is for us to learn how it works, but I need to find out by learning and I'm eager to gain some knowledge.

I'm interested in learning databases as I am also creating a football fan site, and I would like to be able create one for this also.

As I said, I am only starting out with this so Im only learning.
I was just looking for an online community discuss things with in evenings and weekends.

Im just wondering where to post and if its possible here.

Overwhelmed with it all at the moment.

Thanks all and hope to speak to you soon :)

W7 Connection issue

$
0
0
Hi. I am new to postgres, pgAdmin, and psql. I have two workstations on a small 192.168.1.x network on which I have installed postgres 9.2.x servers (and admin tools). The localhost connections work to their respective servers, and postgresql.conf has an uncommented listen_address = '*', which I take to be "listen on all ports". When I try to set up a connection to the other server, I get a timeout error - not listening.

Wondered if anyone else has run into this situation.
Tks in advance

query results different on different computers

$
0
0
I've tried to troubleshoot this problem but with no success. When I run a query I created on my computer the calculations work and the query runs as it should. When someone else runs the same query from the same shared database on our intranet there is a calculation error. Two different people have tried running the query on their machines and they both get the same error. Let me know if more information is required. If anyone has a suggestion I'm all ears!

DB2 Upgrade RTC

$
0
0
Hello All,

I have migrated db2 windows RTC 2003 server edition 32bit v8 to v9.5.
Installed V9.5 and migrated the instance.

After which all commands were working fine under the installation directory.
for ex:
C:\Program Files\IBM\SQLLIB\BIN>db2level
DB21085I Instance "DB2" uses "32" bits and DB2 code release "SQL09059" with
level identifier "060A0107".
Informational tokens are "DB2 v9.5.900.456", "s120228", "IP23305", and Fix Pack

"9".
Product is installed at "C:\PROGRA~1\IBM\SQLLIB" with DB2 Copy Name "DB2COPY1".
But from the other location it says:
C:\Documents and Settings\DB2ADMIN>db2level
SQL1390C The environment variable DB2INSTANCE is not defined or is invalid.

Other Info:
DB2V9.5 installed at C:
it created one instance db2_01.
DB2V8 instance is at d: with db2 instance db2.
and we have migrated the instance db2 to v9.5.

can anyone help on this please?

Thanks.
Meena.s

The multi-part identifier "column name" could not be bound.

$
0
0
Hi can anyone help with my problem..

which the column name is the c.Documenttype

here is my T-sql code..
SELECT [Hourly]
,count(case when C.Documenttype=1 THEN '1' END) as EDI
,count(case when C.Documenttype=2 THEN '2' END) as SI
,count(case when C.Documenttype=1 THEN '1' END) + count(case when C.Documenttype=2 THEN '2' END) as GrandTotal
FROM
(SELECT
dateadd(hour, datediff(hour,CONVERT(VARCHAR(10),B.CreateDate,111 ) ,B.CreateDate)
,CONVERT(VARCHAR(10),B.CreateDate,111)) as [Hourly]
from bookinglinkupdateinformation A
left outer join bookinglinkinformation B
on A.Barcode = B.Barcode
left outer join bookinginformation C
on B.HID = C.ID
left join priority E
on B.Urgent = E.ID
where B.CreateDate between '2013-01-01 00:00:00' and '2013-01-02 23:59:59'
and (A.Stage=0)
and (C.Flag not between '2' and '3')
) idat


thanks in advance..

Getting a macro to assume conditions

$
0
0
Hi guys i was wondering if there be a way to select a columns in a specific way ; for example if target column = 2 then ranges A2:N2 will be selected i need this to be repeated for other columns without specifying the target column. The code i'm using is :

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column = 1 Then
Sheet2.Activate
ActiveSheet.Range("A1:N1").Select
Else
Exit Sub
End If
End Sub

Roles and Privileges - Informix

$
0
0
Hi,
I would like to know to know what is the minimum role (just to do select on catalog views) that is required to connect and access the database for following details in Informix?

DB Name,Instance Name,Version Details etc

Thanks in advance for the details.

Drag and Drop an image to a form

$
0
0
I hava a DB that handels orders I receive by soft-fax.
Then I enter all the data from fax order to my DB and I need to have also the link of the fax that is stored as an image .tif in a folder on C:/ so when i need to check I will be able to open the fax.
I will appricaite your help.

SQLExecute( ) Fails with SQLSTATE=42601

$
0
0
I am trying to learn ODBC/CLI Programming so please bear with me if this appears silly, but I am not able to resolve an apparently simple issue. I have posted the relevant portions of the code below.

The problem is that the SQLExecute () fails with SQLSTATE=42601. The exact error message that I get is "0x00167250 "[IBM][CLI Driver][DB2/NT] SQL0007N The character " " following "ÌÌÌÌÌÌ©%|I0ý" is not valid. SQLSTATE=42601"

Can someone please help me point out issues / ways to debug this Issue on MS Visual Studio 2012 (Express). (DB2 Express C Version 10.1.2)

I have checked the manuals and the SQLSTATE refers to an invalid character in the Query String. As far as I understand, there isn't any! Nor am I able to figure it out from the Error message produced. Please help!

Regards,


/* Define a SELECT SQL Statement That uses a Paramter
Marker. !! Protect from Buffer Overflow !! */

strcpy((char *) sqlQuery, "SELECT EMPNO, LASTNAME FROM ");
strcat((char *) sqlQuery, "EMPLOYEE WHERE JOB = ?");

/*Prepare the SQL Statement */
sqlReturnCode = SQLPrepare(*StmtHandle,
(SQLCHAR*) sqlQuery,
SQL_NTS);

if (sqlReturnCode != SQL_SUCCESS){
//Free Connection Handle
//Free Environment Handle
GetCLIErrorInfo(SQL_HANDLE_STMT, *StmtHandle);
return -60;
}

sqlReturnCode = SQLBindParameter(*StmtHandle,
1,
SQL_PARAM_INPUT,
SQL_C_CHAR,
SQL_CHAR,
sizeof(jobType),
0,
jobType,
sizeof(jobType),
NULL);

if (sqlReturnCode != SQL_SUCCESS){
GetCLIErrorInfo(SQL_HANDLE_STMT, *StmtHandle);
return -70;
}

/*Populate the Bound Application Variable*/
strcpy((char*) jobType, "DESIGNER");

/*Execute the SQL Statement*/
sqlReturnCode = SQLExecute(*StmtHandle);

if (sqlReturnCode != SQL_SUCCESS){
//Free Connection Handle
//Free Environment Handle
GetCLIErrorInfo(SQL_HANDLE_STMT, *StmtHandle);
return -80;
}

need to address

$
0
0

immediately to assist

Viewing all 13329 articles
Browse latest View live