Hi, Is there is a way to run the scripts from a file. For eg: Assume I have a folder named "Scripts"in location c: and there are files (say script1.sql, script2.sql,script3.sql etc) inside the folder. I want to run all the sql files in a single go. How can i acheive this in query analyser? Note: I had learnt to do this using osql utility. Please let me know if there is any other option?
You can issue the exact same command line calling osql, using xp_cmdshell in QA. You may need to double up single quotes.
You could get such a code example within updated books online for SQL Server 2000, in this case that is best one to refer further.
Check out the :r <full path to the script to be included> method mentioned here: ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/3ec89119-7314-43ef-9e91-12e72bb63d62.htm
Im not able get what this is "ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/3ec89119-7314-43ef-9e91-12e72bb63d62.htm"
[quote user="bharathsivam"] Im not able get what this is "ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/3ec89119-7314-43ef-9e91-12e72bb63d62.htm" [/quote] This is the URL of the help topic in BOL. If you are using the English BOL version, you should be able to paste it into BOL. Otherwise just search for "sqlcmd Utility -> about sqlcmd utility" and then "Using the sqlcmd utility.
Apologies for the confusion Im using Sql server 2000. All the aswers pointing me again to use osql utility. Im looking for some other option.