Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Triggers
Message
From
07/06/1999 13:17:30
Christian Bellavance
Université du Québec à Hull
Hull, Quebec, Canada
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
00227039
Message ID:
00227103
Views:
25
Your error comes from the values statement. You can not use the deleted and inserted table just like that. Those tables are like every other table in SQL server, you must use them via a select statement.

Ex.
insert AUDITTABLE (AUD_TABLENAME,AUD_COLNAME,AUD_OLD,AUD,NEW,AUD_DATE,AUD_LANID,COMPNO)
select 'customertable','cus_name',d.cus_name,i.cus_name,getdate(),i.lanid,i.compno)
from inserted i
inner join deleted d on d.cus_number = i.cus_number

Note: I assume that you have a cus_number which is the primary key of your customertable.

Another things is that you do not have to use into since your table is already created.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform