Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQLCMD capture output from :ServerList to a file? Expand / Collapse
Author
Message
Posted Monday, October 29, 2007 6:39 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, October 11, 2013 6:59 AM
Points: 2, Visits: 15
Is there a way to have the output from :ServerList redirected to a file?

I tried :ServerList -o C:\Test.txt

and

:serverlist :Out C:\Test.txt

Tks.
Post #416263
Posted Tuesday, December 18, 2007 6:53 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, June 16, 2010 6:22 AM
Points: 2, Visits: 70
Hi John,

I guess by now you have found:

sqlcmd -Lc > c:\serverlist.txt

Alternatively, you can put your :serverlist in a script file and use the sqlcmd switches
-i (input file) and -o (output file)

Regards, Michael
Post #434252
Posted Thursday, December 20, 2007 11:17 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, October 11, 2013 6:59 AM
Points: 2, Visits: 15
Michael

Thanks for that. I had not got it working as I have been way too busy on a couple of projects.

I will get back to the proj where I was trying to capture the server data into a file soon after new year.

Happy Holidays

Regards JOHN.
Post #435331
Posted Tuesday, September 17, 2013 10:20 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, April 09, 2014 2:22 PM
Points: 40, Visits: 117
Using Powershell is simple, the syntax is sqlcmd -Lc | Out-File c:\serverlist.txt
Post #1495575
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse