April 21, 2009 at 10:20 pm
HI,
I need a batch file to execute sql files,
that batch file must accept input from the user : servername ,dbname,sqlfile path. i have tried but it is giving the error as login failed for user sa.
how can i achieve this? please give me the script.
thanks,
🙂
April 23, 2009 at 3:58 am
how can i create a batch file to execute bunch of sql files, that accept inputs servername,database name.
please help me out.
🙂
April 23, 2009 at 6:04 am
Can you provide some samples of what you've tried, what type of input you're looking to get from the user, and what types of packages you're trying to run?
thanks
April 25, 2009 at 4:10 am
You need to use the OSQL utility for 2K server or OSQL or SQLCMD utility for 2K5 server and up. For 2K5 both utility are available. These command line utilities come with the sever so they already are installed.
You will use them from within a batch file to which you can pass parameters when called and use within with the utilities.
You can check this:
http://bytes.com/groups/ms-sql/721154-how-execute-sql-scripts-using-batch-file for some examples.
And here about utilities:
OSQL: http://msdn.microsoft.com/en-us/library/aa213088(SQL.80).aspx
http://www.databasejournal.com/features/mssql/article.php/3403331/OSQL-Utility.htm
SQLCMD: http://msdn.microsoft.com/en-us/library/ms170207.aspx
Don't just give the hungry man a fish, teach him how to catch it as well.
the sqlist
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply