//Table valued parameter creation
CREATE TYPE [dbo].[tblFactIds] AS TABLE(
[FactId] [int] NULL
//using TVP in SP,just declaring a var of type TVP which i created
DECLARE @FactIds As tblFactIds;//error: parameter or variable has an invalid datatype //tried by adding READONLY also
INSERT INTO @FactIds (FactId)
SELECT * FROM Sampletable
错误:必须声明表变量@FactIds 请帮我解决这个问题。
答案 0 :(得分:1)
它的
CREATE TYPE [dbo].[tblFactIds] AS TABLE
(
[FactId] [int] NULL
)
查看结尾)
?它创建了一种类型。你只使用它一次,类型"仍然是" (如桌子或视图)
并且必须在执行声明
之前执行它或者您可以将GO
置于其间:
CREATE TYPE [dbo].[tblFactIds] AS TABLE
(
[FactId] [int] NULL
)
GO
DECLARE @FactIds As [dbo].[tblFactIds]
以便执行CREATE TYPE
。