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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 TRY CATCH and Primary Key VIOLTAION

Author  Topic 

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2009-07-21 : 11:38:10
i am using the try catch to check if a Primary Key Violation Has occured.
the thing is if i do this while using a query from the "query analayzer" of sql 2005 it work ok, but in the profiler i still see and error - why is that? isn't it suppose to be the same?

and one more question - if i access the Stored PRocedure from NET for example , will or won't i see that exception>?
Thanks
Peleg

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-07-21 : 13:23:44
You see the error in SQL Profiler because the error has occurred. The TRY/CATCH just gracefully handles the situation.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -