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 Helmut Woess on 06/03/06 10:41

Am 2 Jun 2006 16:08:28 -0700 schrieb Jchick:

> Im a newbie with a sql table in a MSDE database that contains fields of
> CustName, BrokerName, Type, Status.
>
> I am trying to write a trigger that does this:
>
> 1. When a new record in a table is added, I would like the selected
> fields to be copied to another table (call it Master).
> 2. If that Master table already contains a record where the CustName =
> CustName, then simply ignore. If CustName does not match anything, then
> add the record to the Master Table
>
> In other words, I am trying to create a table (or even a new database)
> that has unique records in it - making a master customer list.
>
> Any hints on how to get started on this?

It is very easy to do this with a trigger. Read the OnlineManual (see
CRAETE TRIGGER), there are a lot of examples too.
But i don't see the sense of something. Because if i need a unique list of
customers from first table i do a "select distinct custName from table" and
have my result - no need for a master table. But it's your application :-)

bye, Helmut

 

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

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