Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert trigger help

Status
Not open for further replies.
Jul 17, 2003
66
0
0
US
I've never created a trigger and need some help.

I have an inventory location table (iminvloc). Everytime a new record is inserted into this table for location "20V", I'd like to insert a duplicate record in the same table, except for the location field, for every location defined in another table (called imlocfil).

I hope this makes sense. Any help would be appreciated.

 
I'm almost there. Anyone know why this code doesn't work?

Code:
CREATE TRIGGER run_consignment_trigger on iminvloc_sql 
FOR INSERT
AS

BEGIN
if @@ROWCOUNT =0 
return

declare @item char(15), @loc char(3)
select item_no = @item,loc = @loc from inserted
If @loc = "89"
begin
exec create_con_loc @item
end
END

If I just run the create_con_loc stored prodedure (with the parameter) the locations are created correctly. What's wrong with the trigger?

Thanks for any help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top