how to insert values into sql server table from ds routine

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
navya123
Participant
Posts: 4
Joined: Wed Dec 29, 2010 12:21 am

how to insert values into sql server table from ds routine

Post by navya123 »

hi all,
how can i insert values into sql server2008 table from ds after job routine with out using insert statement is there any posiblity ?I am working in ds 8.1 version and windows o/s

thanks in advance

actually i use the insert statement to insert rows in to sql server table it is working fine it was asked to use any other method other than insert statement and with out using any stages in job which i don't know so.....


I am using sqlconn function to connect to sql server returned the errer code -2 and not connecting to sqlserver db how could i get the errer message
Last edited by navya123 on Tue Jan 18, 2011 3:57 am, edited 3 times in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Best to start by posting in the correct forum so I don't have to move it - the FAQ Discussion forum is for discussing topics that could become FAQ postings, not general support.

With that out of the way, curious why you stated "without using insert statement"? You want to put data in a database table, you need to "insert" it, whether that's a conventional insert or (technically) a bulk load. Taking that out of the equation, there are multiple ways to do what you ask - BCI functions, ODBC calls, a script that calls whatever command line utility the database supports...

What are you trying to accomplish?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You could use the bulk loader (bcp).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
navya123
Participant
Posts: 4
Joined: Wed Dec 29, 2010 12:21 am

Re: how to insert values into sql server table from ds routi

Post by navya123 »

looking for ODBC calls and a script that calls whatever command line utility the database supports... how can I establish the ODBC connection through ds after job routine and insert records into the sql server table
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The ODBC calls will require an INSERT statement with parameter markers.
SQLAllocEnv()
SQLAllocConnect()
SQLSetConnectOptions()
SQLConnect()
SQLAllocStmt()
SQLPrepare() and SQLExecute(), or SQLExecDirect()
SQLRowCount()
SQLError()
SQLFreeStmt()
SQLDisconnect()
SQLFreeConnect()
SQLFreeEnv()
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

And your command line utility appears to be SQLCMD. I'm sure your DBA could help you with syntax questions.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply