dbTalk Databases Forums  

Trigger to update field in new record based on second field in new record.

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Trigger to update field in new record based on second field in new record. in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Richard
 
Posts: n/a

Default Trigger to update field in new record based on second field in new record. - 10-23-2010 , 12:20 PM






Here is a SQL statement that I am currently running:

update timecard set tudef1='JP0' where tudef5='JP' and tmatter in
(select mmatter from matter where mloc='30')

I would like this update to happen when a new record is inserted in
the timecard table. How can I set up a trigger to do this.

Thanks in advance

Rich

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Trigger to update field in new record based on second field in new record. - 10-23-2010 , 02:02 PM






Richard (richard.mogy (AT) gmail (DOT) com) writes:
Quote:
Here is a SQL statement that I am currently running:

update timecard set tudef1='JP0' where tudef5='JP' and tmatter in
(select mmatter from matter where mloc='30')

I would like this update to happen when a new record is inserted in
the timecard table. How can I set up a trigger to do this.
See response in microsoft.public.sqlserver.clients.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.