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 Administration (2000)
 OSQL - Executing all scripts in a folder;

Author  Topic 

Hariarul
Posting Yak Master

160 Posts

Posted - 2006-08-08 : 02:09:07
Hi,

How do I execute all the .sql scripts in a folder ?

Thanks in advance,

Hari Haran Arulmozhi

nr
SQLTeam MVY

12543 Posts

Posted - 2006-08-08 : 04:20:16
Have a look at
http://www.nigelrivett.net/SQLTsql/s_ProcessAllFilesInDir.html
@ProcSp would be an sp to execute the osql command via xp_cmdshell.

You could probably use a batch commmand redirecting the output from a dir command also.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Hariarul
Posting Yak Master

160 Posts

Posted - 2006-08-08 : 04:41:53
Thanks for the quick response !! Is there any way to do the same with a batch file ?
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-08-08 : 05:57:18
something like
for %1 in (*.txt) do osql %1 ...


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Hariarul
Posting Yak Master

160 Posts

Posted - 2006-08-08 : 06:48:39
Ok , Thanks !!
Go to Top of Page
   

- Advertisement -