Can't create stored procedure with table output parameter

后端 未结 2 1091
傲寒
傲寒 2020-12-03 22:08

I have this code:

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N\'[dbo].[GetProfitDeals]\') AND type in (N\'P\', N\'PC\'))
DROP PROCEDUR         


        
2条回答
  •  感情败类
    2020-12-03 22:47

    Table parameters are readonly. You cannot select into them. Use Table-Valued Parameters:

    Table-valued parameters must be passed as input READONLY parameters to Transact-SQL routines. You cannot perform DML operations such as UPDATE, DELETE, or INSERT on a table-valued parameter in the body of a routine.

    And Table-Valued Parameters:

    You cannot return data in a table-valued parameter. Table-valued parameters are input-only; the OUTPUT keyword is not supported.

    Read Arrays and Lists in SQL Server for a comprehensive discussion on alternatives.

提交回复
热议问题