功能交易 [英] Transactions in function

查看:73
本文介绍了功能交易的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
任何类型的sql事务都可以通过函数来​​完成?
如果有可能,那怎么办?和
如果没有,那么为什么?

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??

推荐答案


为了使功能有用,它必须产生结果.也可以说该函数返回结果或值.创建函数时,必须指定函数将返回的值的类型.要提供此信息,请在函数名称后键入RETURNS关键字,后跟数据类型的定义.

请参阅链接:
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 [
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[^]


不允许在函数内部进行任何事务.

但是,如果您想做交易之类的事情,
No transactions are not allowed inside functions.

But if you want to do something like transaction then
begin transaction
exec usp_functionname
commit tran


这篇关于功能交易的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆