Issue while executing a sql server stored procedure

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
xch2005
Participant
Posts: 85
Joined: Fri Apr 29, 2005 3:13 am
Location: India

Issue while executing a sql server stored procedure

Post by xch2005 »

Hi,

We actually execute a sql server stored procedure through a Datastage job and to capture the output of the procedure. The procedure on successfull execution would return 0 else -1 and return mesage either 'Success' or 'Failed' ie. 2 output paramenters from the procedure.

We the Datastage job is executed, the job aborts and the message that is there in the job log is like
'APT_CombinedOperatorController,0: Fatal Error: Fatal: [IBM(DataDirect OEM)][ODBC SQL Server Driver][SQL Server]Invalid object name '#calc_val'. '

So I ran the procedure manualy, it completes and returns the return code and return message appropriately. The the temporary table is being created in the procedure and populated in the procedure and it exists when it access it.

Even though the procedure does not break when running manually not sure why the job aborts when running the procedure.

How to debug this kind of issue?

Approciate your help on this.

Thank you.
stephan.zahariev
Premium Member
Premium Member
Posts: 9
Joined: Sun Feb 12, 2012 11:05 am
Contact:

Post by stephan.zahariev »

Hi,

What are you using to execute the stored procedure? Can you execute another stored procedure?

To debug this issue you can use the SQL Server Profiler which will allow you to inspect the SQL queries send from DataStage to the SQL Server. This should give you a clue whats wrong.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Could it be that you neglected the find "#" mark in your parameter, which should read "#calc_val#"?
xch2005
Participant
Posts: 85
Joined: Fri Apr 29, 2005 3:13 am
Location: India

Post by xch2005 »

Hi ArndW,
The '#' was just a temp table inside the procedure and not a parameter.

Hi stephan.zahariev
Can you please let me know how I can use SQL Server Profilier from Datastage?

Thanks
stephan.zahariev
Premium Member
Premium Member
Posts: 9
Joined: Sun Feb 12, 2012 11:05 am
Contact:

Post by stephan.zahariev »

SQL Server Profiler is a tool that comes with SQL Server. You can read more here: http://technet.microsoft.com/en-us/libr ... 81091.aspx

You will need to have it installed locally on your workstation or in the target machine where SQL Server is running. Just keep in mind that you can easily bring down the entire SQL Server if you try to trace too much on heavily used system.

But first I would make sure that DataStage could invoke a simple stored procedure. You can start with this simple scenario.
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post by lstsaur »

Take a look the manual on how DS handles the table name that starts with a # character.
xch2005
Participant
Posts: 85
Joined: Fri Apr 29, 2005 3:13 am
Location: India

Post by xch2005 »

Thanks stephan.zahariev

Yeah, I tried using sql server stored procedures, it does work fine.

Actually when I use the ETL to run the stored procedure, it aborts and the procedure does not run fine. When I run the procedure manually on sql server it runs fine.

Thanks
prasannakumarkk
Participant
Posts: 117
Joined: Wed Feb 06, 2013 9:24 am
Location: Chennai,TN, India

Post by prasannakumarkk »

Invalid object name '#calc_val'
1) What stage you used?
2) What user/schema you used in stage for connection? With which user you succesfully executed outside datastage
3) Is the temp table created with in procedure

Please try using the schema name and check for user privileges.
Thanks,
Prasanna
Post Reply