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 2005 Forums
 Transact-SQL (2005)
 How to close SQLCMD window??

Author  Topic 

smith2487
Starting Member

9 Posts

Posted - 2010-10-15 : 10:36:42

Hi Everyone,
I have a batch (.bat) file that contains the SQLCMD command below.

Sqlcmd -E -S servername -d dbname -q "select RIGHT(sitesystem, 27) from summarizer_sitesystem where role='sms distribution point'" -o logfile.txt

I'm not able to get the cmd window to close automatically after the command is run. When I double click on the batch file, it does what I want it to do, but does not close afterward. The cmd window stays open showing the 1> prompt. Then I have to manually type EXIT to close the window. Any ideas on how I can get this to close after it runs the command?

Thanks!

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-10-15 : 10:52:29
-q should be -Q


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

smith2487
Starting Member

9 Posts

Posted - 2010-10-15 : 11:08:13
-Q did the trick.
Thanks webfred!
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-10-15 : 11:15:32
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -