You are here: Re: Changing column values on table insert trigger « MsSQL Server « IT news, forums, messages
Re: Changing column values on table insert trigger

Posted by Martijn Tonies on 11/07/06 15:37

Hi,

> i have a table and if a record is inserted i will test a numeric value
> in this table. If the this value is greather as 1 million, than an
> status column should be changed from 'A' to 'B'.
>
> Yes and sorry, this is a newbie question.
>
> On Oracle this work simple:
>
> create trigger myTrigger on tableX
> as
> begin
> if :old.x > 100000 then
> :new.y:='B'
> end if;
> end;

MS SQL Server doesn't have "before action" triggers, so you
have to update the table and use the INSERTED virtual table
to know what records were inserted into the table.


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация