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
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 SQLCMD in BAT file user variables

Author  Topic 

woodsy1978
Starting Member

8 Posts

Posted - 2011-07-11 : 11:54:43
Hi,

I am attempting to get the BAT file to ask the user for 3 variables.... can anyone help me ?

sqlcmd -STEMP7 -E -devolive_base -w256 -QEXIT("DECLARE @r int EXEC @r = usp_AddToObservationtbl $,$,$ SELECT @r")


X002548
Not Just a Number

15586 Posts

Posted - 2011-07-11 : 12:55:43
you are trying to get a batch file to issue prompts?

Not bloody likely



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

R0dst3r
Starting Member

1 Post

Posted - 2011-08-04 : 18:21:33
Well, instead of being NOT helpful, I'll send you this way for some long-way-around examples of how to trap strings in a BATch file... http://www.robvanderwoude.com/userinput.php Although, I would highly recommend writing a simple command shell app in C#, VB, whatever - to store your inputs and then start the batch file containing the sqlcmd where the values are pushed into the parameters from the shell app. Heck, at that point, you could do away with the batch file completely and directly handle firing your SQL commands/stored procs...

-Rod
Go to Top of Page
   

- Advertisement -