Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a T-SQL query :

select CAST(0 as float(53)),CONVERT(nvarchar(max),CAST(0 as float(53)),128)

the output of which is


Can some one explain why it is not 0,0 ? The database is SQL Server 2008.


share|improve this question
According to msdn, format 128 is deprecated and might not be supported in future releases. – Andomar Mar 17 '12 at 16:55
@Andomar: I think you need to move your comment as an answer. – a1ex07 Mar 18 '12 at 0:25
Why not to use 0: select CAST(0 as float(53)),CONVERT(nvarchar(max),CAST(0 as float(53)),0) – msi77 Mar 18 '12 at 6:25
@Andomar : I know format 128 is deprecated but this is the best we could have done to remove trailing 0's when the data is numeric. We plan to stick to SQL Server 2008 for some time before we move to other version. Thanks – Egalitarian Mar 18 '12 at 10:33
@msi77 : I want to know why in this case ? – Egalitarian Mar 18 '12 at 10:38

Syntax for CONVERT:

 CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

[style] for float data type :

0 (default)   A maximum of 6 digits. Use in scientific notation, when appropriate.
1 Always 8 digits. Always use in scientific notation.
2 Always 16 digits. Always use in scientific notation.
126, 128, 129 Included for legacy reasons and might be deprecated in a future release.

You can use below command to get expected result :

CONVERT(nvarchar(max),CAST(0 as float(53)),0)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.