June 17, 2013 at 4:40 am
Hi,
How to remove comma and how to convert this column into [numeric](17, 2) this formate.
I have conevrt my this column values in this format [numeric](17, 2) NULL now this column have nvarchar datatype in my source.
Please sugget
drop table dataconvert
go
create table dataconvert
(data nvarchar(15))
insert into dataconvert values('$0')
insert into dataconvert values('$40,000')
insert into dataconvert values('$2,350')
Regards,
KRaj
June 17, 2013 at 4:57 am
There are 2 ways to do this
SELECTCONVERT(NUMERIC(17,2),REPLACE(REPLACE(data,',',''),'$',''))
FROMdataconvert
SELECTCONVERT(MONEY,REPLACE(data,',',''))
FROMdataconvert
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
June 17, 2013 at 5:12 am
Thanks Sir..
Its worked thanks for your help
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy