Re: Trigger to populate table or database
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Sun, 4 Jun 2006 22:45:52 +0000 (UTC)
Jchick (jchickering@xxxxxxxxx) writes:
I'm on to new problems. Trying to learn how to set up the trigger to
send to an Access database's table. I was playing with this idea some
time ago and I believe you got me on the path to Linked Servers. So,
I've got a linked server to an Access database, one table with the
exact same 'fields'. I still want it to write only if the record is
unique. I'm trying to use the suggestions you gave me earlier:
CREATE TRIGGER [Populate AccessTable] ON [dbo].[ClientFile]
AFTER INSERT AS
INSERT mastertable (ProspectName)
SELECT i.ProspectName
FROM inserted i
WHERE NOT EXISTS (SELECT * FROM mastertbl.m WHERE m.ProspectName =
i.ProspectName)
In theory, just replace "mastertbl" with LINKEDSERVER...mastertbl. Maybe
you will have to put something between the dots, Access is not my realm.
But I would not be surprised if it fails, there is always a lots and
ifs and buts with linked server.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- Trigger to populate table or database
- From: Jchick
- Re: Trigger to populate table or database
- From: Erland Sommarskog
- Re: Trigger to populate table or database
- From: Jchick
- Re: Trigger to populate table or database
- From: Erland Sommarskog
- Re: Trigger to populate table or database
- From: Jchick
- Trigger to populate table or database
- Prev by Date: Re: Referential Integrity problem
- Next by Date: Re: Finding prepared statement sql
- Previous by thread: Re: Trigger to populate table or database
- Next by thread: Referential Integrity problem
- Index(es):
Relevant Pages
|
Loading