Solved

Converting Number to String With Decimal Points

Posted on 2009-05-20
3
1,416 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 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
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…

828 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