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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql server inserted table of trigger

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
with SQL server 7.0,

in a table trigger, i want to do something like:

declare @col_name varchar(20)
-- the value of @col_name will be dynamical assigned
...
...

exec ('select ' + @col_name + ' from inserted' )
------------------
error is : invalid object 'inserted'

what can i do?

thanks!

 

Inserted is a virtual table and the scope of the virtual table is limited to the trigger. The statement in the Exec is out of the scope of the trigger so the inserted table doesn't exist for that statement. Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top