Re: insert trigger help
From: soc (zxc0_at_yahoo.com)
Date: 06/10/04
- Next message: Jack D. Ripper: "Re: SQL Query Help"
- Previous message: Aaron [SQL Server MVP]: "Re: linked servers - must they be two way?"
- In reply to: David Portas: "Re: insert trigger help"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 10 Jun 2004 15:01:33 +0100
Thanks David,
yes a join is better
Soc
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@acm.org> wrote in message
news:fqOdnebwrJhN11XdRVn-vg@giganews.com...
> Are you sure you need a trigger? You could just join the two tables when
you
> come to query them (create a view to do this if you like). That way you
> don't have to keep updating anything.
>
> CREATE TRIGGER trgContacts ON Contacts FOR INSERT
> AS
>
> UPDATE Clients
> SET accountno =
> (SELECT DISTINCT accountno
> FROM Inserted
> WHERE email = Clients.email)
> WHERE EXISTS
> (SELECT *
> FROM Inserted
> WHERE email = Clients.email)
>
> I'm assuming that it's only possible to insert 1 account number per email
> address.
>
> --
> David Portas
> SQL Server MVP
> --
>
>
- Next message: Jack D. Ripper: "Re: SQL Query Help"
- Previous message: Aaron [SQL Server MVP]: "Re: linked servers - must they be two way?"
- In reply to: David Portas: "Re: insert trigger help"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|