bulk update in sql server 2005

5 pts.
Tags:
BULK UPDATE
SQL Server 2005
hi.. i have tried UPDATE TableA SET TableA.A1 = TableB.B1, TableA.A2 = TableB.B2 FROM TableB WHERE TableA.A3 = TableA.B3 this query but it is not working.. plz any one suggest me.. thx in advance...

Answer Wiki

Thanks. We'll let you know when a new response is added.

In SQL Server, if you are referening multiple tables in an UPDATE statement with a FROM clause, you need to include a reference to the table being updated in the FROM clause.

UPDATE
    TableA
SET
    TableA.A1 = TableB.B1,
    TableA.A2 = TableB.B2
FROM
    TableA
INNER JOIN
    TableB
ON
    TableA.A3 = TableA.B3

or

;UPDATE
    TableA
SET
    TableA.A1 = TableB.B1,
    TableA.A2 = TableB.B2
FROM
    TableA,
    TableB
WHERE
    TableA.A3 = TableA.B3

Hi MinteeLoki,
what error do you receive?

Do you have some data from:
SELECT TableB.B1, TableB.B2
FROM TableB INNER JOIN TableA ON TableA.A3 = TableA.B3
?

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following