Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run sql script

Status
Not open for further replies.

jsiimml

Programmer
Feb 14, 2006
10
GB
Hi, I have a file with a series of sql statements, eg

Code:
-- truncate tables
truncate table test
truncate table test2
etc

To tidy up my database for testing purposes. I was wondering how I can read the file in (tidydb.sql) and run it line by line (ignoring comments and blank lines).

Appreciate the help. Thanks
 
Look at the FileSystemObject and the split function (depending on whether your db will handle multiple SQL statements per execution or not) as well as ADO Execute method.



A smile is worth a thousand kind words. So smile, it's easy! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top