-2

i have table,

   id        Name   

   1      aaaaAAbbbb 
   2      bbbbAAaaaa 
   3      aabbAAbbaa 

This is my table,i want to update 'AA' with 'BB' using sql server 2008

Cristian Lupascu
  • 39,078
  • 16
  • 100
  • 137

2 Answers2

2
update myTable set [Name] = REPLACE([Name], 'AA', 'BB')

REPLACE applies to SQL Server 2008 upwards.

davek
  • 22,499
  • 9
  • 75
  • 95
  • Thanks...but this will update all 'a' with 'B'..i want Only AA with BB – pradeep Gavhane Jan 09 '15 at 11:43
  • This probably means that your collation is set to case-insensitive. You can get around this by specifiying the collation that `REPLACE` should apply (see the link I referenced). – davek Jan 09 '15 at 11:47
0

You can use

 REPLACE(Name,'AA','BB');

and update you column.