With SQL Server, the Set comes before the tables. You also need to add a from when you are joining multiple tables in an update. As you can see, the syntax is similar, but not identical. You'll get the hang of it.
Unfortunately, you can only update data in 1 table at a time, so you should write a Stored Procecure.
Also, It doesn't make sense to Update the ACno field since you are linking those fields together.
Code:
UPDATE tblCmsA
SET tblCmsA.BCNo = tblCmsB.BCNo,
tblCmsA.Flag = 1
From tblCmsA
INNER JOIN tblCmsB ON tblCmsA.ACNo = tblCmsB.ACNo
UPDATE tblCmsB
Set tblCmsB.flag = '1',
From tblCmsA
INNER JOIN tblCmsB ON tblCmsA.ACNo = tblCmsB.ACNo
*** disclaimer
As with any update or delete, please backup the database first. I don't want to feel responsible for any adverse actions this may cause.
-George
Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.