Friday, February 10, 2012

Converting Numbers

Hello there
I have numbers that i would like to present it as standart currency: 0.00
and still has it as number
So far i could do this only by convert it to text. and it's not good because
i'm export it afterword to Excel.
I've tried to convert it to Decimal(10,2) and it didn't do the job
Is there another way to do this?
..
roy@.atidsm.co.il
: 03-5611606
' 050-7709399Why don't you deal with formatting in Excel post importing? If you need to
automate the process, you can use a vba script that formats the result.
T-SQL is not really intended for formatting, rather for data manipulation.
If you must do this with T-SQL, the STR function allows you to specify
length and decimal places, but it results in a character string.
BG, SQL Server MVP
www.SolidQualityLearning.com
"Roy Goldhammer" <roygoldh@.hotmail.com> wrote in message
news:eAJXE7OnFHA.3552@.TK2MSFTNGP10.phx.gbl...
> Hello there
> I have numbers that i would like to present it as standart currency: 0.00
> and still has it as number
> So far i could do this only by convert it to text. and it's not good
> because
> i'm export it afterword to Excel.
> I've tried to convert it to Decimal(10,2) and it didn't do the job
> Is there another way to do this?
> --
>
> ..
> roy@.atidsm.co.il
> : 03-5611606
> ' 050-7709399
>|||When importing to Excel, you really don't need to format the data - or rathe
r
*shouldn't* format it.
If you let Excel format the values, the data can't end up being corrupted in
any way, and can be used further - using all the capabilities of Excel
(graphs, pivot tables, filtered views,...). But only if data gets to Excel i
n
its native form.
Plus: Excel's formatting capabilities by far exceed those provided by SQL
Server.
ML|||I am not sure what the problem is. So I am just throwing this in the air:
CONVERT(MONEY, Col_name)
--
Cathy B
"ML" wrote:

> When importing to Excel, you really don't need to format the data - or rat
her
> *shouldn't* format it.
> If you let Excel format the values, the data can't end up being corrupted
in
> any way, and can be used further - using all the capabilities of Excel
> (graphs, pivot tables, filtered views,...). But only if data gets to Excel
in
> its native form.
> Plus: Excel's formatting capabilities by far exceed those provided by SQL
> Server.
>
> ML

No comments:

Post a Comment