Click here to Skip to main content
15,890,845 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
Can SQL function have try catch block for exception handeling, But i know we can do exception handling in sql stored procedure ,but my question is about sql UDF function 


What I have tried:

i tried to find this but don't find proper answer
Posted
Updated 15-Mar-16 6:41am
v2
Comments
Herman<T>.Instance 15-Mar-16 12:30pm    
Depends on the version of SQL Server. What brand SQL are you using. To less information to give a proper answer
RahamanATR 15-Mar-16 13:05pm    
which sql version does this allows to do such exception handeling ...
[no name] 15-Mar-16 13:01pm    
No, you can't use TRY-CATCH in user defined function. Create a SP(Stored Procedure) and call the method inside SP. Then implement TRY-CATCH inside SP.
RahamanATR 15-Mar-16 13:37pm    
why not what is the technical reason behind it ...thnx in adv

Enough to choose from: Google helps you properly[^]
 
Share this answer
 
Yes, generally: MSDN TRY...CATCH[^]
For Sql Server it's applicable from 2008.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900