473,372 Members | 1,065 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,372 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 5184
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.