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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-02-27 : 07:28:04
|
| Syed Sherfudeen writes "Dear Sir/Medam i want to run a .sql file through VB 6. In that Sql file i wrote more Insert into statement and Update Statement for particular table so i need that i have to run a Sql file instead of executing each line so please tell me how can i run a sql file in sql server 7 through that vb " |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-02-27 : 07:30:11
|
| The best way to accomplish that in VB is to use the Shell command to execute the osql command line utility and give it the name of the .sql file. Osql is documented in Books Online and it's very easy to use, certainly much easier than trying to parse and execute it in VB.Another option is to put the code of the .sql file into a stored procedure and then execute the stored procedure from VB using an ADO Command object. |
 |
|
|
sharu_tan
Starting Member
11 Posts |
Posted - 2003-02-28 : 04:19:49
|
Dear sir In my project i am converting data from Access 2000 to Sql Server 7 .So first i have to check the data is exist or not in Sql server. if exist then i have to write Update statement otherwise i have to write "Insert into" statement through VB. so please tell me more this regarding. quote: The best way to accomplish that in VB is to use the Shell command to execute the osql command line utility and give it the name of the .sql file. Osql is documented in Books Online and it's very easy to use, certainly much easier than trying to parse and execute it in VB.Another option is to put the code of the .sql file into a stored procedure and then execute the stored procedure from VB using an ADO Command object.
|
 |
|
|
|
|
|