Wednesday, March 7, 2012

OSQL command - Execute all files in a folder;

Hi,
How do I execute all the .sql scripts in a folder with OSQL command?
Thanks in advance,
Hari Haran ArulmozhiCheck out a little free tool called Nant.

http://nant.sourceforge.net/

We use it for all of our product deployments. My Nant scripts go through all of the sql files in a directory and executes them using osql. The one little issue I have with it has to do with nested views because Nant will execute all of the files alphabetically, but there ways around this.|||You could cheat and use the FORFILES (http://technet2.microsoft.com/WindowsServer/en/library/9660fea1-65c7-48cf-b466-204ba159381e1033.mspx?mfr=true) command.

-PatP|||you could use xp_cmdshell and file system objects with sp_OACreate.|||Thanks for your responses !!

No comments:

Post a Comment