I have a table and I need to update some names but I was wondering about the
following queries :
Will both do the same?
Query1
Update mytable
Set Name = Replace(Name,'Jeff','Joe')
Query2
Update mytable
Set Name = 'Joe'
where Name = 'Jeff'
|
I have a table and I need to update some names but I was wondering about the following queries : Will both do the same? Query1
Query2
|
||||
|
|
|
No, they will not do the same thing.
|
|||||
|
|
No, it's not the same. The first query looks for string within the entire string (see replace() "Replaces all occurrences of a specified string value with another string value."), the second looks for the exact string. If you have records like |
|||
|
|