Click here to Skip to main content
13,088,101 members (64,033 online)
Click here to Skip to main content
Add your own
alternative version


3 bookmarked
Posted 9 Mar 2010

SQL SERVER – Order of Columns in Update Statement Does not Matter

, 9 Mar 2010
Rate this:
Please Sign up or sign in to vote.
SQL SERVER – Order of Columns in Update Statement does not matter


I received a few comments that I have not written on simple subjects recently. In fact, this blog is dedicated to all those who are really learning SQL Server and almost all the articles and posts are posted here keeping this goal in mind. One of the questions in the email which requested to write simple subjects was “Does the order of columns in UPDATE statements matter?” Let me try to answer this question today.

The question in detail:

Does the order of the columns in UPDATE statements matter?
For example, is there any difference between option 1 and option 2 of UPDATE statement?

Option 1

UPDATE TableName
SET Col1 = 'Value', Col2 = 'Value2'

Option 2

UPDATE TableName
SET Col2 = 'Value2', Col1 = 'Value'

The answer is NO. There is no difference between them in SQL Server.

There are two related posts on this subject, which I had written previously. I suggest you read them as well. They are pretty old but still valid. I am looking for some suggestions for the same articles too.

SQL SERVER – Transaction and Local Variables – Swap Variables – Update All At Once Concept

Update All at Once concept is purely based on Atomicity (link goes to Wikipedia). In an atomic transaction, a series of database operations, either all of them occur, or nothing occurs. A guarantee of atomicity prevents updates to the database occurring only partially, which can cause greater problems than rejecting the whole series outright.

SQL SERVER – Change Order of Column In Database Tables

Well, I strongly advocate that order of columns in database table should not matter. As a matter of fact, while searching for the subject, I end up on my own blog where I have previously suggested why it was necessary. I suggest you to make the right decision based on your business need.

Reference: Pinal Dave ( 


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

India India
Pinal Dave is a Microsoft Technology Evangelist (Database and BI). He has written over 2200 articles on the subject on his blog at Along with 8+ years of hands on experience he holds a Masters of Science degree and a number of certifications, including MCTS, MCDBA and MCAD (.NET). He is co-author of two SQL Server books - SQL Server Programming, SQL Wait Stats and SQL Server Interview Questions and Answers. Prior to joining Microsoft he was awarded Microsoft MVP award for three continuous years for his contribution in community.

You may also be interested in...

Comments and Discussions

GeneralReally obvious ! Pin
ebrelion20-Mar-10 22:15
memberebrelion20-Mar-10 22:15 
GeneralOrder of columns Pin
Dan Buskirk16-Mar-10 6:12
memberDan Buskirk16-Mar-10 6:12 
GeneralThanks for bringing this up Pin
djj5516-Mar-10 1:14
memberdjj5516-Mar-10 1:14 
GeneralMy vote of 1 Pin
MR_SAM_PIPER15-Mar-10 13:59
memberMR_SAM_PIPER15-Mar-10 13:59 
GeneralMy vote of 1 Pin
Juraj Suchan9-Mar-10 7:19
memberJuraj Suchan9-Mar-10 7:19 
GeneralMy vote of 1 Pin
wookiecrisp9-Mar-10 2:32
memberwookiecrisp9-Mar-10 2:32 
GeneralRe: My vote of 1 Pin
Juraj Suchan9-Mar-10 7:19
memberJuraj Suchan9-Mar-10 7:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170813.1 | Last Updated 9 Mar 2010
Article Copyright 2010 by pinaldave
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid