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 |
|
satheesh
Posting Yak Master
152 Posts |
Posted - 2012-09-21 : 06:10:10
|
| Dear All,I am trying to remove any space in 'postcode' field to re update without space.But not working perfectly.for ExTW9 7HJ - TW97HJGU32 9TY - GU329TYThe space be in middle of any letter.How to replace and merge.Any help will be highly appreciated.ThanksGS |
|
|
satheesh
Posting Yak Master
152 Posts |
Posted - 2012-09-21 : 06:16:14
|
| I found a solution.Its working!!cast(replace(Postcode,' ','') as char(10))Thanks |
 |
|
|
sql-programmers
Posting Yak Master
190 Posts |
Posted - 2012-09-21 : 06:23:38
|
| DROP TABLE #ttCREATE TABLE #tt ( NAME VARCHAR(50) )INSERT INTO #tt ( NAME )VALUES ( 'TW9 7HJ' -- NAME - varchar(50) )INSERT INTO #tt ( NAME )VALUES ( 'GU32 9TY' -- NAME - varchar(50) )SELECT *FROM #ttUPDATE #ttSET NAME = REPLACE(NAME, ' ', '')SELECT *FROM #ttSQL Server Programmers and Consultantshttp://www.sql-programmers.com/ |
 |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2012-09-21 : 06:26:37
|
| Simply,UPDATE YourTable SET Postcode = REPLACE(Postcode,' ', '')In your solution you are missing some characters at the end--Chandu |
 |
|
|
|
|
|