Page 1 of 1

how to insert values into sql server table from ds routine

Posted: Wed Jan 12, 2011 6:38 am
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

Posted: Wed Jan 12, 2011 7:25 am
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?

Posted: Wed Jan 12, 2011 4:29 pm
by ray.wurlod
You could use the bulk loader (bcp).

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

Posted: Thu Jan 13, 2011 3:46 am
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

Posted: Thu Jan 13, 2011 4:37 am
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()

Posted: Thu Jan 13, 2011 6:29 am
by chulett
And your command line utility appears to be SQLCMD. I'm sure your DBA could help you with syntax questions.