Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Converting Number to String With Decimal Points

Posted on 2009-05-20
3
Medium Priority
?
1,424 Views
Last Modified: 2012-05-07
Hi experts
     I'm need convert number data type to string but i need convert with decimal points.
Example when i convert '100.000,00' (number) field to string it seems like '10000000'(str) but i need '100.000,00'(str)
0
Comment
Question by:nwncys
  • 2
3 Comments
 
LVL 1

Expert Comment

by:venkatca
ID: 24429580
Is this what you are looking for?
declare @value decimal(12,2)
set @value=100000
select cast(@value as varchar(12))

Open in new window

0
 
LVL 1

Expert Comment

by:venkatca
ID: 24429628
If you need further formatting with commas, etc, there is an article in this site which discusses the same.

http://www.codeproject.com/KB/database/SQLPhoneNumbersPart_2.aspx
0
 
LVL 12

Accepted Solution

by:
Dimitris earned 1000 total points
ID: 24429727
here u r

You have to convert your decimal field to money and after that to string
see this sample
declare @MyValue as decimal(18,2)
SET @MyValue = 100000.00
 
SELECT CONVERT(nvarchar,cast(@MyValue as money),1)

Open in new window

0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question