Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Logging failed T-SQL commands without Profiler?

Author  Topic 

Angrandir
Starting Member

1 Post

Posted - 2009-10-19 : 15:40:40
Recently I met with the following problem:

A few t-sql scripts need to be run many times against different servers via osql (batch file) while installing some third-party application. The guy responsible for this would like to create a "log" (= file on the same machine where osql is run) containing only failed t-sql commands + possibly corresponding error messages (for his own convenience, to check after installation). For some reason he doesn't want these scripts to terminate on error, but run everything regardless of the result of previous steps if possible.

Something like that could be done with the Profiler - tracing t-sql batches with error <> 0 + error messages or so. Unfortunately using Profiler is not possible, because in most cases he doesn't have sysadmin rights and cannot ask for them (they are not needed for installing this application).

Is it theoretically possible to easily (without extra programming for every single command) to "spool" these failed commands on the client side without sysadmin rights?

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-10-19 : 17:12:52
You can try re-directing the output to a log file: \install\sqlscripts.bat > logfile.txt
He can then filter out any lines he isn't interested in.
Go to Top of Page
   

- Advertisement -