How to run stored procedure from dos command

Microsoft Windows xp professional editio...
October 29, 2009 at 05:24:55
Specs: Windows XP
Hi,

I want to execute one stored procedure on different sets of database.
How can i run it from Dos command?

Regards
Nehal


See More: How to run stored procedure from dos command

Report •


#1
October 29, 2009 at 08:46:32
You don't. There is no dos only a cmd shell. You have to connect to the database to run transact.

http://msdn.microsoft.com/en-us/lib...


Report •

#2
October 30, 2009 at 01:58:37
I got some answer .i.e. i can use sqlcmd to run sql script from my dos command window.

Let me be more specific about requirement:
I have say couple of sql files (variable) which needs to be executed on batch of database (variable).
For sql files (variable) - i will keep this files in one local folder.
For database (variable) - i will keep the information about dbs and their server in one txt file.

Now i want to create one batch file i.e *.bat which will execute 'sqlcmd' picking up *.sql files from folder and database information from the txt file.

How can i achieve this ?


Report •

#3
October 30, 2009 at 06:43:19
might want to start here with the sqlcmd. You will have to figure out how to pipe lines from a cmd procedure to sqlcmd.
I would suggest the tact of making a stored procedure and scheduling it but below will get you started on sqlcmd

Google is your friend btw

http://msdn.microsoft.com/en-us/lib...


Report •

Related Solutions


Ask Question