Solved

Converting Number to String With Decimal Points

Posted on 2009-05-20
3
1,418 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 250 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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…

623 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