Using SQL To Get Net Help Message Information

 

This SQL query will provide you will an example of how to get the Net HelpMsg information from within SQL server

 

SQL Query:

 

Use Master

Set NoCount On

 

Create Table #ErrorTable (ResultColumn VarChar(500))

 

Declare @Command SysName, @Variable SysName

Declare @Message varchar(500)

 

Set @Variable = '5' -- Error Code

Set @Command = 'Net HelpMsg ' + @Variable + ''

 

Insert Into #ErrorTable

Exec Master..Xp_CmdShell @Command

 

Delete From #ErrorTable Where ResultColumn is Null

 

Select @Message = ResultColumn From #ErrorTable

Print 'Error Message ' + @Variable

Print 'Translates To :'

Print @Message

 

Drop Table #ErrorTable

 

Set NoCount Off

 

Published Sunday, June 24, 2007 8:22 AM by dhite
Filed under:

Comments

No Comments