Solved

Converting Number to String With Decimal Points

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now