473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 5187
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Markus | last post by:
If I start an INSERT ... the Result is an "x Row(s) affected" on the console. Is it possible to print out my own messages (e.g. to output the value of a variable)? How can I do my own...
5
by: galsaba | last post by:
When I run an "append query" or "Make a Table Query" I get a pop up window alert message that alerts me that I am goint to add rows, etc. How can I make my query that these alerts will not show...
0
by: Carl Rosenberger | last post by:
Hi all, my application does a lot of threading. The output window becomes completely unusable because of all the "thread exited" messages popping up. Is there any way to stop them? ...
8
by: Andrew Robert | last post by:
Hi Everyone. I tried the following to get input into optionparser from either a file or command line. The code below detects the passed file argument and prints the file contents but the...
0
by: Hollywood | last post by:
Good day dear members of the comp.databases.ms-access newsgroup. I'm using the new Acess 2007 "Collect data by using e-mail messages" functionality but it seems the generated e-mail by Outlook...
1
by: Stuart Harden | last post by:
We use Exchange 2007, but asp.net programs we have written to send out the mail. Is there an asp.net control to request the bounce backs be to a specific address? We can of course do this on...
3
by: Mark Shroyer | last post by:
I guess this sort of falls under the "shameless plug" category, but here it is: Recently I used a custom metaclass in a Python program I've been working on, and I ended up doing a sort of write-up...
10
by: Andrew Ducker | last post by:
I have an application, and I'd like it to be able to generate "log" messages. Other applications can then attach to it and listen to these messages, but the main application shouldn't have to...
2
by: Dansk | last post by:
Hi all, I'm trying to write messages at compile time to the output window like I used to with the good old #pragma message Is this possible in c#? TIA Dansk.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.