请问这种 Inserted 一般怎样处理呢?我用游标处理代码如下,有问题只好改成取其中一条:select top 1 * from Inserted ……:
------------------------------------------------------------------------------------------------------------------------------------Declare my_cursor cursor
for
Select org, dest, content From Insertedopen my_cursor
fetch next from my_cursor into @vFrom, @vTo, @vContent
while(@@fetch_status=0)
begin Exec proc_SaleFilter @vFrom, @vTo, @vContent fetch next from my_cursor into @vFrom, @vTo, @vContent
end
close my_cursor
deallocate my_cursor
------------------------------------------------------------------------------------------------------------------------------------Declare my_cursor cursor
for
Select org, dest, content From Insertedopen my_cursor
fetch next from my_cursor into @vFrom, @vTo, @vContent
while(@@fetch_status=0)
begin Exec proc_SaleFilter @vFrom, @vTo, @vContent fetch next from my_cursor into @vFrom, @vTo, @vContent
end
close my_cursor
deallocate my_cursor
不使用触发器,也不使用游标
--用静态游标和forward_only属性try.
set nocount on
Declare my_cursor cursor STATIC forward_only
---------------------------------------------------------
for
Select org, dest, content From Inserted open my_cursor
fetch next from my_cursor into @vFrom, @vTo, @vContent
while(@@fetch_status=0)
begin Exec proc_SaleFilter @vFrom, @vTo, @vContent fetch next from my_cursor into @vFrom, @vTo, @vContent
end
close my_cursor
deallocate my_cursor