I am using SQL Server, and in the query below, I have a concern. I am not sure if the field on the left will update with the field on the right (coming from the same table) when I do a where in list.
update loc
set locShortName = locName
where locid in (3,4,11,13,14,15,16,18,19,20,21,24,32,41,45,68,69,77,82,85)
update loc set locShortName = locName where locid = 3 (move to next record in the list)
update loc set locShortName = locName where locid = 4 (move to next record in the list)
update loc set locShortName = locName where locid = 11(move to next record in the list)
and so on...
I would think it would take the fist number in the list and address the field value setting, then move to the next in the list.
Are my expectations correct?
Thanks in advance.
update loc set locShortName = locName where locid in
(3,4,11,13,14,15,16,18,19,20,21,24,32,41,45,68,69,77,82,85)
You can consider that it works like this:
Take a row. If locid is in the list, will take the locName of that row and put it in locShortName.
Take another row. If locid is in the list, will take the locName of that row and put it in locShortName.
take another row. if locid isn't in the list, it won't do anything.
And so on
It do not process one each at time, but the concept result will be something like this