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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Removing spaces within a numerical field

Author  Topic 

deanfp
Starting Member

26 Posts

Posted - 2012-01-25 : 09:06:11
Hi

We have a SQL column that contains credit card information. I'm aiming to somehow remove the spaces within that column so that its a numerical value with no breaks.

Example

Current credit card is 1234 5678 9101112

I want it to be

123456789101112

I know that using TRIM can reduce the leading and trailing spaces but what command can achieve the above? Cannot seem to find an answer.

Thanks!

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-01-25 : 09:06:57
replace(yourColumn,' ','')


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

deanfp
Starting Member

26 Posts

Posted - 2012-01-25 : 09:12:45
Was it that simple? Thanks:)
Go to Top of Page
   

- Advertisement -