AuliyaIkhsan


how to format an integer in sql 2005

for ex: 1.09876 i want to format to 1.1

in access i can use : format(field,'0.0') as field1

thanks




Re: Formating

Manivannan.D.Sekaran


Here You can't format directly.. You can use the following code...

Code Snippet

Select Cast(1.050009 as Numeric(5,1))

--or

Select Convert(Numeric(5,1),1.050009)







Re: Formating

Kent Waldrop My07

Another alternative if you are interested in converting to character data is the STR function:

select str(1.09876,5,1) as Format

/*
Format
------
1.1
*/