October 15, 2007 at 12:37 am
Hi,
Can any one please help me in this topic?
MS SQL Server introduced TRY & Catch Method for Error handling.
if i am not wrong, I found its not fully functional like VS.NET Try & Catch method, I mean to say it is not working all the time.
Is it So?
I tried with this Example.
CREATE TABLE #Table1
(col1 int, col2 int)
Qry - 1
=======
BEGIN TRY
INSERT INTO #Table1
VALUES ('aaa', 2000)
END TRY
BEGIN CATCH
PRINT 'Error in Data'
END CATCH
Result : Error in Data (User Defined error)
Qry - 2
=====
BEGIN TRY
SELECT * FROM #Table2
END TRY
BEGIN CATCH
PRINT 'Error in Table Name'
END CATCH
Result : System Error is coming
#Table2 not exist in the database.
I think this should also check by the Try and catch method also,
If i am wrong please correct me,
Cheers!
Sandy
--
October 15, 2007 at 1:00 am
Sandy
This behaviour is documented in Books Online. Have a look at this topic:
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/248df62a-7334-4bca-8262-235a28f4b07f.htm
John
October 15, 2007 at 1:10 am
Hey John Mitchell,
Thanks for sending me the link,
(Nice link, really helpful)
Cheers!
Sandy.
--
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply