Like this ?
UPDATE Persons SET DefEAddres=EmailAdd.EAddress
WHERE Persons.PersonId = EmailAdd AND EmailAdd.Type = 'PRIVATE'
--
Aílsom F. Heringer
[EMAIL PROTECTED]
Skype: ailsom.osklen
Analista de Sistemas
--
Osklen
Departamento de Informática
Rio de Janeiro - RJ
On 8/16/06, Philip B [EMAIL PROTECTED] wrote:
What would be the equivalent in SQL Server syntax to do the following:
*---
SELECT 0
USE Persons
SELECT 0
USE EmailAdd ORDER PersonID
SET FILTER TO type = PRIVATE IN EmailAdd
SELECT
I *always* have problems with these on SQL Server - but bol to the rescue:
try:
UPDATE persons
SET DefEAddres=em.EAddress
FROM persons p, EmailAdd em
WHERE p.PersonId = em.PersonId
AND em.Type = 'PRIVATE'
n.b. NOT p.DefEAddres
Andrew Davies MBCS CITP
- AndyD 8-)#
From: Andy Davies [EMAIL PROTECTED]
I *always* have problems with these on SQL Server - but bol to the rescue:
try:
UPDATE persons
SET DefEAddres=em.EAddress
FROM persons p, EmailAdd em
WHERE p.PersonId = em.PersonId
AND em.Type = 'PRIVATE'
n.b. NOT p.DefEAddres
Stephen,
Andy, you should create the join instead of putting its clause in the
where.
Is that just personal preference or is there a technical reason for doing
so? I'm not taking sides either way -- just curious about your reason for
saying he SHOULD create the join.
David Stevenson
--
No
Thanks Andy,
This format worked the best for me. I didn't realize we could use FROM
in the UPDATE command.
Here is my actual syntax that worked. (I originally gave a sample of
code with not actual tables/fields)
UPDATE [crmprice].[dbo].[Person] SET Pers_EmailAddress = E.Emai_EmailAddress
FROM
6 matches
Mail list logo