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
 General SQL Server Forums
 New to SQL Server Programming
 How do you format int datatype result

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-09-05 : 09:43:09
Hugh writes "Hi,
I'm using this in my query:

SELECT CAST(lotw AS varchar(5)) + ' x ' + CAST(lotl AS varchar(5)) + ' / ' + CAST(lotsq AS varchar(6)) AS lotsqft FROM testTable

lotw, lotl, lotsq are all of type int. Is it possible for sql server to format them in a number format:

LIke This
------------------------
lotsqft
------------------------
400 x 50 / 20,000
50 x 50 / 2,500
2,000 x 1,850 /3,700,000
========================


NOT LIke This
------------------------
lotsqft
------------------------
400 x 50 / 20000
50 x 50 / 2500
2000 x 1850 /3700000
========================

Thanx for your help, I do hope I did not stump you, lol.

-hugH"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-05 : 09:46:58
Better to do this type of formations at the client side (Fron End Application or Reports)
Otherwise you need to use Convert Function with money datatype

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -