z 怎样解决字段重复插入的问题
set ANSI_NULLS ONset QUOTED_IDENTIFIER ON
go
ALTER trigger [t1_goods_to_stock1] on [dbo].[goods]
for insert
as
begin
declare @T_count int
declare @T_id nchar(10)
select @T_id=G_id,@T_count=G_count from inserted
if (not exists(select G_id from goods where G_id=@T_id))begin
insert into stock( T_id,T_count) select G_id,G_count from goods
end
end