Solved

SQL Server 2000 ErrorMessages vs SQL Server 2005

Posted on 2007-11-25
8
244 Views
Last Modified: 2010-03-19
Hi,
In sqlserver 2000  I check @@Error after each and very SQL Statement and if > 0 return -1

In Current 2005 in Catch Block  I use ERROR_MESSAGE (System function) to catch error and Raise it back to my client.

In SQL Server 2000  Cant we use ERRORMESSAGE (Detailed Description of Error like in SQLServer 2005) in a stored procedure...
0
Comment
Question by:dotnet0824
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 15

Assisted Solution

by:spprivate
spprivate earned 50 total points
ID: 20345753
http://sqljunkies.com/Article/564F5D77-2F7E-41FB-91C7-353B6D84BF94.scuk
This is a goodway to handle errors with detailed messages
HTH
0
 
LVL 31

Accepted Solution

by:
James Murrell earned 150 total points
ID: 20346290
0
 

Author Comment

by:dotnet0824
ID: 20346708
so in sql server 2000 we have to create our own custom message descriptions to give a clear picture of the Error by adding to to sp_addmessage

But in SQL Server 2005 we dont need to do anything of that sort and its pretty straight forward using
inbuilt system function ERROR_Message ......Am I right?
0
 
LVL 31

Expert Comment

by:James Murrell
ID: 20346845
as far as i am aware yes...
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 18

Assisted Solution

by:Yveau
Yveau earned 50 total points
ID: 20348876
Yep, in the catch block just use the ERROR_MESSAGE() function to retrieve the error that caused that fact that the catch block was entered. So no more @@Error catching after each SQL statement, just run some code in a try block and do the error tracking and handling in the catch block with the above mentioned function.

Also these functions can add some nice functionality:
        ERROR_NUMBER() AS ErrorNumber,
        ERROR_SEVERITY() AS ErrorSeverity,
        ERROR_STATE() AS ErrorState,
        ERROR_PROCEDURE() AS ErrorProcedure,
        ERROR_LINE() AS ErrorLine,
        ERROR_MESSAGE() AS ErrorMessage;
(also in the catch block !)

Hope this helps ...
0
 

Author Comment

by:dotnet0824
ID: 20351990
So my final quesiton is this... IN Sql Server 2000 There is no way to catch and use RaisERROR to the client directly like u do in SQL Server 2005 ERROR_Message............. So only ErrorNumbers can be Raised in SQL Server 2000  ........So no message information being raised
0
 
LVL 31

Expert Comment

by:James Murrell
ID: 20352076
I think you are correct with that assumption
0
 
LVL 18

Expert Comment

by:Yveau
ID: 20352219
Indeed, that is correct ... when you do not declare the user messages first.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how the fundamental information of how to create a table.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now