0

質問があります

create procedure pr_InsertFilterOnItemCreation
@zCategoryId int,
@zItemId int,
@zFilterid int
as
declare @productId int
set @productId = (SELECT convert(int,IDENT_CURRENT('item')))
if( @productId<>null)
begin
insert into t_lnk_cat_product_filter_item set   cde_catid=@zCategoryId,cde_productid=@productId,cde_filterid=@zFilterid,cde_filteritemid=@zItemId
select 1
end

エラーが発生しています

キーワード「set」付近の構文が正しくありません

4

3 に答える 3

1

あなたのINSERT INTO声明はこのように書かれるべきです:

INSERT INTO t_lnk_cat_product_filter_item
      (cde_catid,    cde_productid, cde_filterid, cde_filteritemid)
SELECT @zCategoryId, @productId,    @zFilterid,   @zItemId

それ以外の:

insert into t_lnk_cat_product_filter_item 
set cde_catid = @zCategoryId,
    cde_productid = @productId,
    cde_filterid = @zFilterid,
    cde_filteritemid = @zItemId
于 2012-10-11T12:56:49.820 に答える
0

あなたがするか:

insert into t_lnk_cat_product_filter_item 
values(@value1, @value2, @value3)

また

insert t_lnk_cat_product_filter_item 
select @value1, @value2, @value3
于 2012-10-12T15:06:38.850 に答える
0

なぜここで設定したいのか、テーブルが空の場合は値を挿入するか、対応する値を更新するだけです

insert into t_lnk_cat_product_filter_item    
(cde_catid, cde_productid, cde_filterid, cde_filteritemid)                                                                                                                 values ( @zCategoryId, @productId, @zFilterid, @zItemId)
于 2012-10-11T13:08:21.493 に答える