![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Capture SQL Messages How do capture SQL Messages ? lets say I have a SQL stored procedure that use print statements. In query analyser the results of the print statements they would appear in the message tab. How can I capture these messages in a Power shell script ? Thanks |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Capture SQL Messages dm_14 wrote: > How do capture SQL Messages ? > > lets say I have a SQL stored procedure that use print statements. In query > analyser the results of the print statements they would appear in the message > tab. How can I capture these messages in a Power shell script ? > > Thanks I was trying to show you a practical example using SMO, but cannot seem to figure out how to run a stored procedure from it. Normally, you're information will go directly to the console, but you need to script that stored procedure to be run by a PowerShell script. I can't explain it better than that right now. What version of SQL? I think SMO is only supported with 2005, so that might not even be an option. Marco |
My System Specs![]() |
| | #3 (permalink) |
| | Use the sqlcmd utility with SQL Server 2005 or use isql (or osql if you prefer) with previous versions. sqlcmd Utility isql Utility Running the osql Utility |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Capture SQL Messages SMO is for management of SQL Server not data access To run the stored proc you need to use ADO.NET. You could return the information as output parameters. I'll put an example on my blog -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "Crito" wrote: > > Use the sqlcmd utility with SQL Server 2005 or use isql (or osql if you > prefer) with previous versions. > 'sqlcmd Utility' > (http://msdn2.microsoft.com/en-us/library/ms162773.aspx) > 'isql Utility' > (http://msdn2.microsoft.com/en-us/lib...7(SQL.80).aspx) > 'Running the osql Utility' > (http://msdn2.microsoft.com/en-us/lib...8(SQL.80).aspx) > > > -- > Crito > |
My System Specs![]() |
| | #5 (permalink) |
| | sqlcmd, isql and osql are the command line equivalents of query analyzer. you'd use the exact same commands and you'd receive the exact same results. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| ATI TV Wonder Pro A/V Capture | Virtual PC | |||
| Video Capture | Vista General | |||
| How can you capture individual thumbnails not full capture ? | Vista music pictures video | |||
| Capture | Vista music pictures video | |||
| Capture com events | PowerShell | |||