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 |
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2009-07-28 : 06:46:44
|
i am doing the next try catch raiseerror :DECLARE @Err int DECLARE @ErrorMessage NVARCHAR(4000); DECLARE @ErrorSeverity INT; DECLARE @ErrorState INT; SET @Err = 0 BEGIN TRY INSERT vw_Billing.... VALUES..... END TRY BEGIN CATCH SET @Err = @@ERROR SELECT @ErrorMessage = ERROR_MESSAGE(), @ErrorSeverity = ERROR_SEVERITY(), @ErrorState = ERROR_STATE(); END CATCH IF @Err = 2627 RETURN 0 RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState ); the thing is that withogut the try catch i see the error like this :quote: Msg 4457, Level 16, State 1, Procedure casp_InsertLaRbLevel1, Line 38The attempted insert or update of the partitioned view failed because the value of the partitioning column does not belong to any of the partitions.
but if i do this with RAISEERROR waht i see is not an error but an "information" error :quote: Msg 50000, Level 16, State 1, Procedure casp_InsertLaRbLevel1, Line 64The attempted insert or update of the partitioned view failed because the value of the partitioning column does not belong to any of the partitions.
you can see that the Msg values has changed to 50000 instead of 4457.this problem causes the service that writes to the DB to see this Error in the level of "Information" and not as "Error"how can i fix it?ThanksPelegIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-28 : 06:53:59
|
| HiWhen RAISERROR is used with the msg_id of a user-defined message in sys.messages, msg_id is returned as the SQL Server error number, or native error code. When RAISERROR is used with a msg_str instead of a msg_id, the SQL Server error number and native error number returned is 50000.When you use RAISERROR to return a user-defined error message, use a different state number in each RAISERROR that references that error. This can help in diagnosing the errors when they are raised.-------------------------R.. |
 |
|
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2009-07-28 : 07:07:43
|
| can you tell me what/where to change in the RAISEERROR?Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
|
|
|
|
|
|
|