Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 ADO ans sql script

Author  Topic 

noamg
Posting Yak Master

215 Posts

Posted - 2003-10-23 : 03:32:38
hi,

how to run the sql script via ADO (C++) in order to create the tables and the SP ?
(P.S. take the .sql file as is and send it to the server )

thanks




Noam Graizer

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-10-23 : 04:16:09
This is really a C++ question, there must be C++ sample code in the ADO SDK.
It's simple really.
1. Open the file and read it into memory.
2. Break up the string using the GO statements (each GO has to be run as a separate batch).
3. For each block of code, execute it against the active connection object.

Alteratively, call OSQL via a command line.


Damian
Go to Top of Page

noamg
Posting Yak Master

215 Posts

Posted - 2003-10-23 : 04:19:35
there are 'SET' command, which can not be statment object !


Noam Graizer
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-10-23 : 04:22:51
Maybe if you want to explain your problem I can give you a decent answer.
You are making me work hard at guessing how to solve your problem.


Damian
Go to Top of Page

noamg
Posting Yak Master

215 Posts

Posted - 2003-10-23 : 04:27:56
I have to install the database by the db.sql file.
one option is using the osql utility. but it is an external process, a batch file. the application doesn't know if fail and why.
second - using ADO. but I do not want to parsing the file. i want to take the file as is and to send it to the server.

is it possible ?

Noam Graizer
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-10-23 : 04:35:15
No


Damian
Go to Top of Page
   

- Advertisement -