Pounds of Formatting Fun

  • Comments posted to this topic are about the item Pounds of Formatting Fun

  • Nice question, I don`t remember I had the need to use FORMAT before, thanx.

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • This was removed by the editor as SPAM

  • Interesting question, thanks Andy. 🙂

  • 🙂 Thanks, Andy!

  • I think it makes perfect sense to have FORMAT function work on numeric values from right to left. Consider the following:

    SELECT FORMAT(1234,'###,###,###')

  • To my understanding SQL Server may not need much use of FORMAT as if I want that users need to enter mobile no based on US style i.e. 3-3-4, then those kind of check can be done in the application side itself. No?

    But yes, its a good question. Outcome of the question was slightly unpredictable to me. but I scored 2 marks. 🙂

    Thanks.

  • Chris, you might be right on that. It just wasn't what I was expecting, right or wrong!

  • Nice question but an easy one.

    When I installed my SQL Server 2012 Express , I have discovered this way to format a number in the BOL and I have tested it ( and dug in my memory ) , so I have had only to dig it up.

    It is important to remember what it is difficult to use it remotely ( CLR... ) what is written in the BOL

    "This function will not be remoted since it depends on the presence of the CLR. Remoting a function that requires the CLR would cause an error on the remote server."

    Useful feature but with some limit...

  • With ZEROS:

    SELECT FORMAT(12354,'000-00-0000') AS 'SSN'

    Returns "000-01-2354"

  • I found this to be very interesting because it got me thinking of the age-old argument of formatting the data in the database versus on the client-side. There are times when you just want it formatted on the database side of the world and this is a useful function to have in the toolbox. Thanks.

  • Ed Wagner (6/3/2015)


    I found this to be very interesting because it got me thinking of the age-old argument of formatting the data in the database versus on the client-side. There are times when you just want it formatted on the database side of the world and this is a useful function to have in the toolbox. Thanks.

    +1 .

    You have succeeded to write in an understandable English language what I was thinking.

  • Nice straightforward question. Don't know why it should be two points, though. 🙂

    Of course the second reference in the explanation is a lovely illustration of the sheer awfulness of some of Microsoft's .NET documentation :sick: - maybe that's why?

    Tom

  • Very interesting question, thanks.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • It was just what I expected.

    So there was no fly in the ointment.

Viewing 15 posts - 1 through 15 (of 19 total)

You must be logged in to reply to this topic. Login to reply