SQL Problem in Datastage

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
sambitsamantray
Premium Member
Premium Member
Posts: 24
Joined: Wed Sep 10, 2008 7:27 am
Location: Houston
Contact:

SQL Problem in Datastage

Post by sambitsamantray »

Hello,

I've defined a sql query in the "Before SQL" of my source DRS stage. I'm using SQL Server as my database. After executing the job, when i'm checking the director log of that job, i'm getting a different query in the log in the "BeforeSQL".

Query which i have defined in the job design: DELETE FROM A WHERE CONVERT(VARCHAR(10),DATE,101) IN (SELECT CONVERT(VARCHAR(10),DATE,101) FROM B)

Query found in the job log: DELETE FROM A WHERE DATE IN (SELECT DATE FROM B)

Is this a bug or this is just a case of compatibility issue of DRS stage with SQL Server?
Sambit Samantray
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

There's no way for it to change one query into another like that. I'd suggest you really check that you are seeing what you think you are seeing. Is that logged query from an older run with an initial version of the query? Are you in fact looking at the correct job's log?

Try right clicking on the SQL Server stage in question and selecting 'Grid View', sometimes that makes odd settings easier to find.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chandra.shekhar@tcs.com
Premium Member
Premium Member
Posts: 353
Joined: Mon Jan 17, 2011 5:03 am
Location: Mumbai, India

Post by chandra.shekhar@tcs.com »

@Sambit
How can u get the SQL query in your job logs?
I am unable to see anything related to the query in my job logs. :(
Thanx and Regards,
ETL User
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

I am not sure about DRS stage.
But i tries the same in OCI stage some months back and the query mentioned in before/after sql was not dispalyed in the log.
pandeeswaran
sambitsamantray
Premium Member
Premium Member
Posts: 24
Joined: Wed Sep 10, 2008 7:27 am
Location: Houston
Contact:

Post by sambitsamantray »

chulett wrote:There's no way for it to change one query into another like that. I'd suggest you really check that you are seeing what you think you are seeing. Is that logged query from an older run with an initial version of the query? Are you in fact looking at the correct job's log?

Try right clicking on the SQL Server stage in question and selecting 'Grid View', sometimes that makes odd settings easier to find.
I've tried it several times and the log is showing me a different query as mentioned in my previous post. When the job is executing it's not considering the convert function i've used.
Sambit Samantray
sambitsamantray
Premium Member
Premium Member
Posts: 24
Joined: Wed Sep 10, 2008 7:27 am
Location: Houston
Contact:

Post by sambitsamantray »

chandra.shekhar@tcs.com wrote:@Sambit
How can u get the SQL query in your job logs?
I am unable to see anything related to the query in my job logs. :(
When you're using a DRS stage, after executing the job when you check the job logs you can see a log saying "Executing SQL". You can double click on the log following that to view the query.

I'm not sure about the stage you're using right now.
Sambit Samantray
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

PX DB stages don't show SQLs whereas Server DB stages show SQLs. This might be the reason.

Sambit, can you remove the CONVERT function from your SQL and see what is displayed in log? Infact, try replacing CONVERT with some other function and see what happens.
Kandy
_________________
Try and Try again…You will succeed atlast!!
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

Does the query showing in the log match what your before sql use to state? (i.e. you've since changed to include the convert). We have had a case of a job reverting to an old self... eventually we re-created the job.

The only other thing springing to mind is if you're running the job via a sequence but actually running a different job to what you think you're running.
sambitsamantray
Premium Member
Premium Member
Posts: 24
Joined: Wed Sep 10, 2008 7:27 am
Location: Houston
Contact:

Post by sambitsamantray »

In my job i was trying to remove the timestamp part of a datetime value by using convert function in the before sql. That didn't work out due to the issue which i had mentioned in my previous posts.

Instead of doing that i created another job which will load my source with dates only which eventually resoilved my problem, but the primary issue is still unresolved.

I'd verified earlier also if i was running a different job or my sequence is calling a different job, but it was always the correct job which i was running.
Sambit Samantray
Post Reply