|
Posted by Roy Harvey on 08/21/07 11:01
On Tue, 21 Aug 2007 01:29:46 -0700, Yas <yasar1@gmail.com> wrote:
> INSERT INTO
> Table2(STATUS,attribute15,email,lastname1,lastname2,name,company,startDate)
> SELECT 'Active' AS STATUS, b.Attribute15, b.email, b.lastname1,
> b.lastname2, b.name,
> b.company, b.startDate
> FROM Inserted b LEFT OUTER JOIN
> Table2 a ON b.Attribute15 = a.Attribute15
> WHERE a.Attribute15 IS NULL
>Just out of curiosity how would you modify the above to use
>NOT EXISTS ?
INSERT INTO Table2
(STATUS,attribute15,email,
lastname1,lastname2,name,
company,startDate)
SELECT 'Active' AS STATUS, b.Attribute15, b.email,
b.lastname1, b.lastname2, b.name,
b.company, b.startDate
FROM Inserted b
WHERE NOT EXISTS
(SELECT * FROM Table2 a
WHERE b.Attribute15 = a.Attribute15)
Roy Harvey
Beacon Falls, CT
Navigation:
[Reply to this message]
|