SQL的函数中不能使用INSERT EXEC

在函数内的'INSERT EXEC' 中对带副作用的或依赖于时间的运算符的使用无效。

 

以下例子是错误的,改成存储过程。

create function f_cid(@taskid varchar(100),@str1 varchar(100)) 
returns @t_level table(abc varchar(50) )
as
begin
  insert into @t_level execute sp_GetValue @taskid,@str1,''
  return
end

另:函数也不能创建临时表,create  table  #tab。

 

posted @ 2017-07-27 17:23  小闲石  阅读(1050)  评论(0编辑  收藏  举报