SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Capture output of sqlcmd before shutdown services
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

TRACEYSQL
Aged Yak Warrior

593 Posts

Posted - 12/07/2013 :  22:17:37  Show Profile  Send TRACEYSQL an ICQ Message  Reply with Quote
I have a bat file, which I run the statement sqlcmd -S Sqlservername -E -Q "select STATUS from MYDATABASE.DBO.CONTROLLOG" -o d:\scripts\testoutput1.txt -e

Once captured the output
if the status is COMPLETE, then I can restart some application services.

How do I capture the status in a variable so I can do
----The start part works, I have this in a bat file too
IF @STATUS = 'COMPLETE'
SC \\SERVER START "MY APPLICATION"
END
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000