Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 FormatNumber Equivalent

Author  Topic 

alzogbi
Starting Member

9 Posts

Posted - 2002-05-20 : 06:13:54
Hi Gurus,
What is the equivalent function in T-SQL of FormatNumber is VB.NET?

Thank you,

Mazen

rihardh
Constraint Violating Yak Guru

307 Posts

Posted - 2002-05-20 : 06:56:23
Why???

Go to Top of Page

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2002-05-20 : 09:44:51
Look in BOL for CAST and CONVERT
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-05-20 : 10:06:54
FormatNumber (I believe) is a display function, it doesn't change the datatype of the data, just how it is displayed.

I believe what rihardh means by "Why???" is you should not manage the formatting and display of data on the data layer. Use your middle-ware or front end to format the data as you wish.

CAST and CONVERT will change the datatype. If you are looking to add comma's and decimal points, etc. (In SQL) you would need to convert you numberic datatype to a character type and use the (rudamentry) string manipulation frunctions to accomplish your goal.

<O>
Go to Top of Page

alzogbi
Starting Member

9 Posts

Posted - 2002-05-21 : 04:57:28
quote:

Why???



Hi,
Because I built a generic ASPX UC that reads from a SqlDataReader and it builds a dynamic table which should shows the values. Now, because I have many data types returned in the SqlDataReader, I am inforced to make all kind of formatting in the SQL SP.

I agree with all of you who says that this should be done in the Middleware and I am doing this myself since the past 4 years but this is a very special case! :)

Thanx!


Go to Top of Page
   

- Advertisement -