vps
vps

Reputation: 1367

insert values into table valued parameters in sql server

I am seeing an error when I insert values into user type table. The type created successfully, but I am not able to insert values into that type.

How to insert values into that table type?

CREATE TYPE ProductType1 AS TABLE
(
    fld_SkillTargetID int
)

I'm trying to insert values into that table type using this statement:

declare @par as ProductType1
insert into @par values('fld_SkillTargetID')values(5166)

but am getting error. I am not able to insert the values into that table type.

Upvotes: 5

Views: 27240

Answers (1)

Oded
Oded

Reputation: 499132

You have one too many values - and you don't need to escape the field name:

insert into @par (fld_SkillTargetID)
values(5166)

Upvotes: 11

Related Questions