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

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 。

http://www.cnblogs.com/xingyukun/archive/2008/05/21/1203711.html

posted @ 2009-06-25 19:45  emanlee  阅读(671)  评论(0编辑  收藏  举报