我有一个过程和一些自定义类型来传递一些数据给它:
CREATE TYPE StringList AS TABLE
(Value NVARCHAR(255));
GO
CREATE TYPE KeyValueList AS TABLE
(
Id uniqueidentifier,
Value NVARCHAR(255));
GO
CREATE PROCEDURE
#update_AttributeFormel(
@modelPrefix NVARCHAR(255),
@definitionNeutralName NVARCHAR(255),
@newFormula NVARCHAR(255),
@providersToRemove StringList READONLY,
@providersToAdd KeyValueList READONLY)
AS ....
ManagementStudio 没有显示任何错误(就像我注释掉类型声明时一样),但是当我执行脚本时,我收到以下错误:
Msg 2715, Level 16, State 3, Procedure #update_AttributeFormel, Line 2
Column, parameter, or variable #4: Cannot find data type StringList.
Parameter or variable '@providersToRemove' has an invalid data type.
Msg 2715, Level 16, State 3, Procedure #update_AttributeFormel, Line 2
Column, parameter, or variable #5: Cannot find data type KeyValueList.
Parameter or variable '@providersToAdd' has an invalid data type.
此处解释的实现:
http://www.simple-talk.com/sql/t-sql-programming/temporary-tables-in-sql-server/
http://www.sqlteam.com/article/sql-server-2008-table-valued-parameters
有谁知道为什么会这样?