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

Source: Internet
Author: User

Now you cocould 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.

Solution: delete ufnfunctiontest and create ufnfunctiontest.

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.