469,926 Members | 1,767 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

Write "Messages" window to a log file?

Is there a way to write the information that appears in the "Messages"
window in SQL Server Management Studio to an external log file? I'd
like to keep a record of these logs as I run each script once a month
and it would be useful to compare run times for each step. We have
several places where we insert variations of the following code along
the way which gives us a snapshot of how long a particular step took:

SET @Msg = '[STEP 1] - Starting - __GlobalDeleteNonClusteredIndexes
'+
CONVERT(varchar(20),GETDATE(),101)+' '+
CONVERT(varchar(20),GETDATE(),108)

RAISERROR(@Msg, 0, 1) WITH NOWAIT

Any help is appreciated.
Aug 7 '08 #1
1 5045
Hermes (ma********@gmail.com) writes:
Is there a way to write the information that appears in the "Messages"
window in SQL Server Management Studio to an external log file? I'd
like to keep a record of these logs as I run each script once a month
and it would be useful to compare run times for each step. We have
several places where we insert variations of the following code along
the way which gives us a snapshot of how long a particular step took:

SET @Msg = '[STEP 1] - Starting - __GlobalDeleteNonClusteredIndexes
'+
CONVERT(varchar(20),GETDATE(),101)+' '+
CONVERT(varchar(20),GETDATE(),108)

RAISERROR(@Msg, 0, 1) WITH NOWAIT

Any help is appreciated.
Try View->Results->To File from the menu.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Aug 7 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mark Shroyer | last post: by
10 posts views Thread by Andrew Ducker | last post: by
2 posts views Thread by Dansk | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.