You are here: Re: Trigger to populate table or database « MsSQL Server « IT news, forums, messages
Re: Trigger to populate table or database

Posted by Erland Sommarskog on 10/02/52 11:49

Jchick (jchickering@gmail.com) 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@sommarskog.se

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

 

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

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