Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Everyone,
Any kind of sql transaction can be done by function or not ??
if it is possible then how?? and
if no then why??
Posted
Comments
OriginalGriff 27-Jul-12 7:44am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.

Hi,
For a function to be useful, it must produce a result. This is also said that the function returns a result or a value. When creating a function, you must specify the type of value that the function would return. To provide this information, after the name of the function, type the RETURNS keyword followed by a definition for a data type.

Refer the links:
http://www.functionx.com/sqlserver/functions/create.htm[^]
http://msdn.microsoft.com/en-us/library/ms174318.aspx[^]
http://stackoverflow.com/questions/5500618/is-it-possible-to-create-sql-server-function-using-transaction[^]
 
Share this answer
 
No transactions are not allowed inside functions.

But if you want to do something like transaction then
SQL
begin transaction
exec usp_functionname
commit tran
 
Share this answer
 
v2

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