Simple Selects

  • Comments posted to this topic are about the item Simple Selects

  • Thought that I would try it with the £ sign as well. Sure enough, it does the same thing! Learnt something new.

  • Interesting question, thanks.

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

  • This was removed by the editor as SPAM

  • probably related to the isnumeric function

    ISNUMERIC returns 1 for some characters that are not numbers, such as plus (+), minus (-), and valid currency symbols such as the dollar sign ($)

    https://msdn.microsoft.com/en-us/library/ms186272.aspx

    however SELECt + goes give an error

    Incorrect syntax near '+'.

  • Very thanks dear,

    i never expect this answer.

    good question, i learnt something new.

    Thanks,
    Shiva N
    Database Consultant

  • And the data type is "money"

    select$100 as ival

    intomytab

    select

    tname= t.name

    ,cname= c.name

    ,coltype= y.name

    fromsys.tables t

    inner join sys.columns c

    on t.object_id = c.object_id

    inner join sys.types y

    on c.system_type_id = y.system_type_id

    wheret.name = 'mytab'

    drop table mytab

  • JenkinD02 (1/30/2015)


    Thought that I would try it with the £ sign as well. Sure enough, it does the same thing! Learnt something new.

    I gave it a go with the Euro as well. SELECT € also returns 0.00.

  • https://msdn.microsoft.com/en-us/library/ms179882.aspx

    SELECT £

    SELECT $

    SELECT ¥

    SELECT €

    SELECT ?

    SELECT ?

    SELECT ?

    SELECT ?

    SELECT ?

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • Sean Pearce (1/30/2015)


    https://msdn.microsoft.com/en-us/library/ms179882.aspx

    SELECT £

    SELECT $

    SELECT ¥

    SELECT €

    SELECT ?

    SELECT ?

    SELECT ?

    SELECT ?

    SELECT ?

    That is exactly the point, money and smallmoney data types accept a number of currency symbols and it's good to remember that "SQL Server does not store any currency information associated with the symbol, it only stores the numeric value"

    So you must store your currency information somewhere else or you'll lose it! that can give you as many headaches as distinct currencies you use :hehe:

  • Hmm, interesting question, never seen that before.

  • Sean Pearce (1/30/2015)


    https://msdn.microsoft.com/en-us/library/ms179882.aspx

    SELECT £

    SELECT $

    SELECT ¥

    SELECT €

    SELECT ?

    SELECT ?

    SELECT ?

    SELECT ?

    SELECT ?

    What I find interesting about this is that it is always 0.00; I'm not sure about the rest of them (heck, I don't recognize half of them), but the ¥ does not have decimal places (by default anyway, just like the US $ is usually two decimal places but can go smaller). Which would mean it is not displaying the currency according to its rules.

  • I actually got .0000 for "SELECT $", so that definitely goes along with the "doesn't store currency type" information.

  • Nice question.

  • SQL Easter Egg (sort of)! 😛

    Thanks for sharing; didn't know that either. Anyone see any practical application?

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

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