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.