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
 what's wrong in this trigger

Author  Topic 

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-03-29 : 01:09:48
ALTER TRIGGER Trigger1
ON countries
FOR UPDATE AS
begin
insert into country1
select * from updated
end

Above trigger is been saved in sql 2005 query window
But if i execute any update stmt as
" update countries set cname='malathi' where cid=3 "
it shows following error
Invalid object name 'updated'.

Malathi Rao

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-29 : 01:11:23
Try "INSERTED" instead of "UPDATED" if you want new values.
If you want the old values, try "DELETED".



Peter Larsson
Helsingborg, Sweden
Go to Top of Page

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-03-29 : 01:20:18
quote:
Originally posted by Peso

Try "INSERTED" instead of "UPDATED" if you want new values.
If you want the old values, try "DELETED".



Peter Larsson
Helsingborg, Sweden



Thanq it works perfect

Malathi Rao
Go to Top of Page

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-03-29 : 01:22:01
For storing this old values we hav to create new tables
Writing this type of triggers are helpfull in auditing database

Malathi Rao
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-29 : 01:59:11
quote:
Originally posted by jogin malathi

Writing this type of triggers are helpfull in auditing database
They are? I have to remember this.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-03-29 : 02:29:12
quote:
Originally posted by Peso

quote:
Originally posted by jogin malathi

Writing this type of triggers are helpfull in auditing database
They are? I have to remember this.


Peter Larsson
Helsingborg, Sweden


Sorry to say
but i did'nt get YOU

Malathi Rao
Go to Top of Page
   

- Advertisement -