curious_learner
curious_learner

Reputation: 43

Error in update query: Incorrect syntax near '='

Trying to run a simple update query but it throws the following error on line 5

update t3
set t3.Act_Flg = 'N', t3.ActiveEndDate = getdate()
from dbo.STG_EmployeeMaster_TEMP t3 
inner join dbo.TEMP_EmployeeMaster t1 on t3.GPN = t1.GPN, t3.Name = t1.Name
where t1.RecordChangedFlag = 'Y' 

It is throwing an error:

Incorrect syntax near '='.

I am not getting where is mistake?

Upvotes: 2

Views: 1720

Answers (1)

JudgingNotJudging
JudgingNotJudging

Reputation: 679

Use AND.

update t3
set t3.Act_Flg='N', t3.ActiveEndDate=getdate()
from dbo.STG_EmployeeMaster_TEMP t3 INNER join dbo.TEMP_EmployeeMaster t1
on t3.GPN=t1.GPN and
t3.Name = t1.Name
where t1.RecordChangedFlag='Y' 

Upvotes: 4

Related Questions