Hi, I have a SP that accepts a Value (item_id) and then creates a folder under its name. Is there anyway with an Insert Trigger to call the SP and pass the value? something like?
sp_itemFolder item_id
From Inserted
You could try:
create trigger tr_insert_table on table
for Insert
on
declare @item varchar(50)
select @item = inserted.item_id from inserted
exec sp_itemFolder @item_id
If you have multiple items, I think you will have to use a cursor.. BAD thing to have in triggers. But this would work:
create trigger tr_insert_table on table
for insert
on
create trigger tr_insert_table on table
for Insert
on
declare @item varchar(50)
declare loop_var cursor for
select inserted.item_id from inserted
open loop_var
fetch next from loop_var into @item
while @@fetch_status = 0
begin
exec sp_itemFolder @item
fetch next from loop_var into @item
end
close loop_var
deallocate loop_var
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.