0
点赞
收藏
分享

微信扫一扫

Cannot perform alter on 'dbo.ObjectName' because it is an incompatible object type

Aliven888 2023-11-17 阅读 36

Now you could try it yourself:

--First, we create a inline-table function which returns a table 
Create Function dbo.ufnFunctionTest (@param int, @param1 int)      
returns table      
AS      
RETURN      
(      
 select 1 as id      
)      

--Then, we want to alter it to a multi-statement table-valued function,      
--and we will get an error here      
alter Function dbo.ufnFunctionTest (@param int, @param1 int)      
returns @tt table      
(      
    id int      
)  
begin      
 insert into @tt values (1)      
 return      
end


if  you really want to "alter" the type of your function, actually you need to drop it first, then create a new one.

解决方法:先删除ufnFunctionTest ,再创建ufnFunctionTest 。




举报

相关推荐

0 条评论