Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
KlausEngel
Yak Posting Veteran
85 Posts |
Posted - 2009-08-06 : 17:06:08
|
| I have a column of data type nvarchar with data of the format 1234-1234. I'd like to remove the dash '-' and update the records accordingly. can anyone gove me a hint?thanks. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
KlausEngel
Yak Posting Veteran
85 Posts |
Posted - 2009-08-07 : 08:13:42
|
| thank you. but how do I properly select the values, is there something like regular expression function ?UPDATE table1 SET column2 = REPLACE(column2,'-','')WHERE column 2 ?? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-08-07 : 08:36:33
|
quote: Originally posted by KlausEngel thank you. but how do I properly select the values, is there something like regular expression function ?UPDATE table1 SET column2 = REPLACE(column2,'-','')WHERE column 2 ??
What do you mean by properly selected values?TryUPDATE table1 SET column2 = REPLACE(column2,'-','')WHERE column2 like '[0-9][0-9][0-9][0-9][-]%'MadhivananFailing to plan is Planning to fail |
 |
|
|
KlausEngel
Yak Posting Veteran
85 Posts |
Posted - 2009-08-18 : 01:05:48
|
Thank you, that's what I needed!quote: Originally posted by madhivanan
quote: Originally posted by KlausEngel thank you. but how do I properly select the values, is there something like regular expression function ?UPDATE table1 SET column2 = REPLACE(column2,'-','')WHERE column 2 ??
What do you mean by properly selected values?TryUPDATE table1 SET column2 = REPLACE(column2,'-','')WHERE column2 like '[0-9][0-9][0-9][0-9][-]%'MadhivananFailing to plan is Planning to fail
|
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-08-18 : 02:21:23
|
quote: Originally posted by KlausEngel Thank you, that's what I needed!quote: Originally posted by madhivanan
quote: Originally posted by KlausEngel thank you. but how do I properly select the values, is there something like regular expression function ?UPDATE table1 SET column2 = REPLACE(column2,'-','')WHERE column 2 ??
What do you mean by properly selected values?TryUPDATE table1 SET column2 = REPLACE(column2,'-','')WHERE column2 like '[0-9][0-9][0-9][0-9][-]%'MadhivananFailing to plan is Planning to fail
You are welcome MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|