3

I created a batch file and placed the following line into it:

runas /user:internal\c39293 "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\SQLCMD.EXE" -E -S WLDZ9454 -d ChadDb -Q "usp_Test"  

I was trying to run the stored procedure usp_Test on the server WLDZ9454 against the ChadDb database.

When I execute it, I just get info regarding param options, no error mesage, so it isn't clear to me what I am doing wrong.

Note that when I run the code minus the code that attempts to run under different credentials, it works:

"C:\Program Files\Microsoft SQL Server\100\Tools\Binn\SQLCMD.EXE" -E -S WLDZ9454 -d ChadDb -Q "usp_Test" 

1 Answer 1

3

I suspect it's because you have not enclosed the program you are running and its parameters in quotes.

SqlCmd is therefore executed without any parameters.

 runas /user:internal\c39293 """C:\Program Files\Microsoft SQL Server\100\Tools\Binn\SQLCMD.EXE"" -E -S WLDZ9454 -d ChadDb -Q ""usp_Test"""
Sign up to request clarification or add additional context in comments.

1 Comment

Close. This did it: runas /user:internal\c39293 "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\SQLCMD.EXE -E -S WLDZ9454 -d ChadDb -Q "usp_Test"". thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.