Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Batch file to promt input, connect to SQL to execu

Author  Topic 

padhma.p
Yak Posting Veteran

91 Posts

Posted - 2009-09-01 : 15:52:13
Hello,

I have 3 SP.

SP1: spAutoCreateTable
Input parameters: month, startdate,enddate,year
Use: creates a table in the DB.

SP2: spAutoIncrementDate
Input parameters:startdate and enddate in mm/dd/yyyy format only.

SP3: spAutoDataCollectionPVZ
No input parameters, but just execute this one.

My Question:
I want to create a batch file which will promt user for input for the SP1 and SP2.
I want to connect to SQL SP, make use of the user entered input's via DOS promt as the input for the SP1 and SP2.
Execute SP1 first, followed by a success/failure message.
Execute SP2 second, followed by a success/failure message.
Execute SP3 second, followed by a success/failure message.

Is this possible?

I have the skeleton os the batch file.
Not sure how to connect to SQL SP. I have tried using SQLCMD util as well.
Not sure. Any relavent article or guidance would be helpful.

Thank you.

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-09-02 : 04:58:08
Look up the osql command in Books Online.
Go to Top of Page
   

- Advertisement -