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
 General SQL Server Forums
 New to SQL Server Programming
 executing .sql file

Author  Topic 

sujeethbala2110
Starting Member

29 Posts

Posted - 2006-10-04 : 08:50:57
hi

i have a .sql file, which i can run using query analyzer. is there any other way to execute this file, like using a .bat file or .exe file. user should be able to execute this file without using query analyzer or any other database tools. i cannot call this from my main programe.
this should be a self executable file.

thanks

suji

Kristen
Test

22859 Posts

Posted - 2006-10-04 : 08:53:37
You can use OSQL from the command line, but other than that you will have to write a little VB application or somesuch that connects to the DB and runs the script.

Or provide a TextBox in your application that they can past it in to - but then they could paste any SQL in there, which might not be a good thing!

Kristen
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-10-04 : 08:54:10
.SQL file is not an executable file...It's just file containing bunch of SQL statements. You can not execute it by itself (Otherwise why would anybody bother to purchase SQL Server )

You should use OSQL utility to execute this file.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page
   

- Advertisement -