我必须在查询结果中插入一个假列,它是表值函数的返回值.此列数据类型必须是唯一标识符.最好的方法(我认为…)是使用 newid()
函数.问题是,我不能在这种类型的函数中使用 newid()
:
I have to insert a fake column at the result of a query, which is the return value of a table-value function. This column data type must be unique-identifier. The best way (I think…) is to use newid()
function. The problem is, I can’t use newid()
inside this type of function:
Invalid use of side-effecting or time-dependent operator in 'newid()' within a function.
推荐答案
这里有一个聪明的解决方案:
here’s a clever solution:
create view getNewID as select newid() as new_id
create function myfunction ()
returns uniqueidentifier
as begin
return (select new_id from getNewID)
end
我无法相信这一点.我在这里找到了:http://omnibuzz-sql.blogspot.com/2006/07/accessing-non-deterministic-functions.html
that i can’t take credit for. i found it here:
http://omnibuzz-sql.blogspot.com/2006/07/accessing-non-deterministic-functions.html
-唐
这篇关于sql server 函数中的 newid()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,
版权声明:本文采用知识共享署名4.0国际许可协议[BY-NC-SA]进行授权
文章名称:《sql server 函数中的 newid》
文章链接:http:
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
没看过瘾,不妨看看类似sql server 函数中的 newid的编程文章!
编程相关文章(10)
我如何获取和使用头文件 &lt
本文介绍了我如何获取和使用头文件 <graphics.h>在我的 C++ 程序中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!问题描述我一直在寻找头文件<gra
2. MMSegmentation训练自己的数
.markdown-body pre,.markdown-body pre>code.hljs{background:#fff;color:#000}.hljs-comment,.hljs-quote,.hljs-variable{color:green}.hljs-built_in,.hljs-keyword,.hl
静态初始化命令惨败
本文介绍了静态初始化命令惨败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!问题描述我正在从一本书中读到关于 SIOF 的信息,它举了一个例子:I was
一起来学Linux命令(一)
.markdown-body pre,.markdown-body pre>code.hljs{color:#333;background:#f8f8f8}.hljs-comment,.hljs-quote{color:#998;font-style:italic}.hljs-keyword,.hljs-selecto
服务器出现丢包的原因103.88.35.
.markdown-body pre,.markdown-body pre>code.hljs{color:#333;background:#f8f8f8}.hljs-comment,.hljs-quote{color:#998;font-style:italic}.hljs-keyword,.hljs-selecto
在线体验 Windows 11「GitHub 热
.markdown-body pre,.markdown-body pre>code.hljs{color:#333;background:#f8f8f8}.hljs-comment,.hljs-quote{color:#998;font-style:italic}.hljs-keyword,.hljs-selecto
全网独一份,手把手带你搞定Androi
.markdown-body pre,.markdown-body pre>code.hljs{color:#333;background:#f8f8f8}.hljs-comment,.hljs-quote{color:#998;font-style:italic}.hljs-keyword,.hljs-selecto
“g++"和“c++"编译器
勇敢去编程! 勇敢的热爱编程,未来的你一定会大放异彩,未来的生活一定会因编程更好!
TOP