locked
how to formate number in sqlserver 2005 RRS feed

  • Question

  • hi,

    i would like to show degree at the end of number.

    how can i do it in sqlserver 2005

    ex1) 1234853487°

    2)23432.234°

    yours sincerely


    Monday, May 27, 2013 4:56 PM

Answers

  • SELECT CAST(x AS VARCHAR(18)) + '°' AS TemperatureDegrees

    (X would be your temperature float field)


    Sebastian Sajaroff Senior DBA Pharmacies Jean Coutu

    Monday, May 27, 2013 5:00 PM
  • It may be better to apply extra formatting in your client application.

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Monday, May 27, 2013 6:14 PM

All replies

  • SELECT CAST(x AS VARCHAR(18)) + '°' AS TemperatureDegrees

    (X would be your temperature float field)


    Sebastian Sajaroff Senior DBA Pharmacies Jean Coutu

    Monday, May 27, 2013 5:00 PM
  • It may be better to apply extra formatting in your client application.

    For every expert, there is an equal and opposite expert. - Becker's Law


    My blog

    Monday, May 27, 2013 6:14 PM
  • In any tiered architecture, display formatting is done in the presentation layer and never in the database. This is covered in the first week of any class on programming. This principle has been the basis of all software engineering for ~50 years. 

    Please stop programming until you know what you are doing. 


    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking in Sets / Trees and Hierarchies in SQL

    Tuesday, May 28, 2013 1:27 AM