Current record data with trigger

Current record data with trigger

Post by Arjan & Saskia van der Haa » Wed, 10 Apr 2002 00:04:11



I have created the following trigger

create trigger afterinsert
on
_smdba_._company_
after insert
as
insert into _config_ (config)
values (???)

??? this should be the field [name] of the table _smdba_._company_ of the
record that was inserted. How can I select the field of that record.

Thanks in advance,
Arjan

 
 
 

Current record data with trigger

Post by Keith Kratochvi » Wed, 10 Apr 2002 00:13:29


When working with triggers, you have access to two virtual tables...inserted
and deleted.
Read more about them within Books Online.

--
Keith, SQL Server MVP



Quote:> I have created the following trigger

> create trigger afterinsert
> on
> _smdba_._company_
> after insert
> as
> insert into _config_ (config)
> values (???)

> ??? this should be the field [name] of the table _smdba_._company_ of the
> record that was inserted. How can I select the field of that record.

> Thanks in advance,
> Arjan


 
 
 

Current record data with trigger

Post by Rashmi Dave[M » Sat, 13 Apr 2002 01:09:37


create trigger afterinsert
 on
_smdba_._company_
for  insert
 as
insert into _config_ (config)
select fieldname from inserted where secondfieldname = ' abc value'

This posting is provided AS IS with no warranties, and confers no rights.
You assume all risk for your use. ? 2001 Microsoft Corporation. All rights
reserved.
--------------------

| Newsgroups: microsoft.public.sqlserver.programming
| Subject: Current record data with trigger
| Date: Mon, 8 Apr 2002 17:04:11 +0200
| Organization: Tiscali bv
| Lines: 17

| NNTP-Posting-Host: xs241-192-51.dial.tiscali.nl
| X-Trace: reader1.tiscali.nl 1018278215 2157 195.241.192.51 (8 Apr 2002
15:03:35 GMT)

| NNTP-Posting-Date: Mon, 8 Apr 2002 15:03:35 +0000 (UTC)
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
| Path:
cpmsftngxa07!tkmsftngxs01!tkmsftngp01!newsfeed00.sul.t-online.de!t-online.de
!newsfeed.freenet.de!news-x2.support.nl!news.tiscali.nl!not-for-mail
| Xref: cpmsftngxa07 microsoft.public.sqlserver.programming:248013
| X-Tomcat-NG: microsoft.public.sqlserver.programming
|
| I have created the following trigger
|
| create trigger afterinsert
| on
| _smdba_._company_
| after insert
| as
| insert into _config_ (config)
| values (???)
|
| ??? this should be the field [name] of the table _smdba_._company_ of the
| record that was inserted. How can I select the field of that record.
|
| Thanks in advance,
| Arjan
|
|
|