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.
Author |
Topic |
TsqlWorld
Starting Member
14 Posts |
Posted - 2008-07-18 : 14:40:57
|
Need your help to catch error description & insert into log tableI have added following type of code.DECLARE @ret int, retmess varchar(50)exec @ret=@Proc_nameIF @ret <> 0 BEGINprint 'Error # is ' + ltrim(str(@ret)) + '.'select @retmsg = [description] from master.dbo.sysmessages where error = @ret and msglangid=1033; -- for englishprint 'Error Message - ' + @retmsg + '.'ENDOut put is something like thisThe statement has been terminated.Error # is 547.Error Message - The %ls statement conflicted with the %ls constraint "%.*ls". The conflict occurred in database "%.*ls", table "%.*ls"%ls%.*ls%ls..This doesn't give me correct error message.Thanks |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|