January 29, 2015 at 10:47 pm
Comments posted to this topic are about the item Simple Selects
January 30, 2015 at 12:45 am
Thought that I would try it with the £ sign as well. Sure enough, it does the same thing! Learnt something new.
January 30, 2015 at 12:55 am
Interesting question, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
January 30, 2015 at 1:31 am
This was removed by the editor as SPAM
January 30, 2015 at 2:33 am
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 '+'.
January 30, 2015 at 2:49 am
Very thanks dear,
i never expect this answer.
good question, i learnt something new.
Thanks,
Shiva N
Database Consultant
January 30, 2015 at 2:51 am
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
January 30, 2015 at 2:55 am
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.
January 30, 2015 at 3:06 am
https://msdn.microsoft.com/en-us/library/ms179882.aspx
SELECT £
SELECT $
SELECT ¥
SELECT €
SELECT ?
SELECT ?
SELECT ?
SELECT ?
SELECT ?
January 30, 2015 at 3:45 am
Sean Pearce (1/30/2015)
https://msdn.microsoft.com/en-us/library/ms179882.aspxSELECT £
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:
January 30, 2015 at 3:52 am
Hmm, interesting question, never seen that before.
January 30, 2015 at 6:32 am
Sean Pearce (1/30/2015)
https://msdn.microsoft.com/en-us/library/ms179882.aspxSELECT £
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.
January 30, 2015 at 6:39 am
I actually got .0000 for "SELECT $", so that definitely goes along with the "doesn't store currency type" information.
January 30, 2015 at 6:41 am
Nice question.
January 30, 2015 at 7:24 am
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