Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

In SQL Server 2012,

Does a merge statement like this :

WHEN MATCHED THEN
update SET A.len = B.len

updates a row even if A.len equals to B.len ?

Or does the SQL SERVER knows to ignore this situations ?

If not, would it be better to add the matching condition the following :

WHEN MATCHED AND A.len <> B.len THEN
update SET A.len = B.len

Is there any difference in this on other Sql servers ?

Thanks,

share|improve this question
1  
The short answer is yes. If you say UPDATE column1 = column2 it will always do the update. It's not going to compare those columns unless specifically instructed to do so. –  Zane Dec 23 '13 at 16:44
7  
Probably the same as The Impact of Non-Updating Updates I would guess. –  Martin Smith Dec 23 '13 at 16:47
1  

1 Answer 1

The short answer is yes. You can read more about the Merge command syntax at the Microsoft MSDN site.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.