all groups > sql server new users > january 2007 >
You're in the

sql server new users

group:

SQL Update


Re: SQL Update AlterEgo
1/17/2007 10:59:21 AM
sql server new users: Vayse,

I think this should work:

update dbo.ZZZ_Monthly_Pre
set IsNewBusiness = 1
from
dbo.ZZZ_Monthly_Pre
inner join dbo.AAA_Monthly_Clients on ZZZ_Monthly_Pre.Ref =
AAA_MonthlyClients.Ref

-- Bill

[quoted text, click to view]

SQL Update Vayse
1/17/2007 3:38:58 PM
Hi
I have a select statement, which works fine.
SELECT dbo.ZZZ_MONTHLY_Pre.ISNewBusiness
FROM dbo.ZZZ_MONTHLY_Pre
INNER JOIN
dbo.AAA_MONTHLY_Clients ON
dbo.ZZZ_MONTHLY_Pre.Ref = dbo.AAA_MONTHLY_Clients.Ref

Now I wish to an update,
UPDATE dbo.ZZZ_MONTHLY_Pre
INNER JOIN
dbo.AAA_MONTHLY_Clients ON
dbo.ZZZ_MONTHLY_Pre.Ref = dbo.AAA_MONTHLY_Clients.Ref
SET dbo.ZZZ_MONTHLY_Pre.IsNewBusiness = 1

but I get: Incorrect syntax near the keyword 'INNER'.

What should I be doing differently?
thanks
Vayse


Re: SQL Update Vayse
1/18/2007 9:48:59 AM
Thanks, thats works. It was driving me mad!

[quoted text, click to view]

AddThis Social Bookmark Button