Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 trigger problem

Author  Topic 

packymyles
Starting Member

21 Posts

Posted - 2008-04-24 : 14:06:26
my teammate says that his triggers work in his database, and then he sends me the database and i have all the tables and data created, and then execute the trigger and i get this error:Msg 207, Level 16, State 1, Procedure Assembly_Quantity_tr, Line 7
Invalid column name 'Quantity_of_Part'.


create trigger Assembly_Quantity_tr
on Assembly_Configuration
for update as
begin
update Assemble
set Quantity = Quantity + (select Quantity_of_Part from inserted)
where assemble.assemble_number = (select assembly_number from inserted)
end

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-04-24 : 14:19:00
You are missing a column then. Looks like it expects it to be in Assembly_Configuration but it isn't.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2008-04-24 : 14:48:30
quote:
Originally posted by packymyles

my teammate says that his triggers work in his database, and then he sends me the database and i have all the tables and data created, and then execute the trigger and i get this error:Msg 207, Level 16, State 1, Procedure Assembly_Quantity_tr, Line 7
Invalid column name 'Quantity_of_Part'.


create trigger Assembly_Quantity_tr
on Assembly_Configuration
for update as
begin
update Assemble
set Quantity = Quantity + (select Quantity_of_Part from inserted)
where assemble.assemble_number = (select assembly_number from inserted)
end



try this

create trigger Assembly_Quantity_tr
on Assembly_Configuration
for update as
begin

update Assemble
set Quantity = Quantity + (select Quantity from inserted)
where assemble.assemble_number = (select assembly_number from inserted)
end

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-24 : 15:00:01
If suggestion doesnt work for you post your table structures.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-04-24 : 15:04:06
You guys should be aware that we've gone through this exact error with him already and after many, many posts and him saying the column exists and showing us DDL, it turns out that the column did not exist.

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=101610

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -