Saturday, December 31, 2005

 

FOR Power

Power of FOR


“FOR” command in Windows (not a T-SQL FOR statement) is a useful statement. I am using this command in almost all of my windows and SQL Server administrative script requirements. Here is the one use of FOR command in SQL Server environment.
I had a requirement to automatically load all SQL scripts from a particular folder into a SQL Server. For this requirement I preferred batch script, which use FOR command. We have scheduled a job in SQL Server with the batch file that loads SQL Scripts into the SQL Server.

You can find the batch file from the following link.
http://www.skchandra.com/batchfiles/load_scripts.zip

The batch file uses the Windows authentication method and loads all SQL scripts with .SQL extension from the folder where the batch file resides.


Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?