September 20, 2012 at 9:33 am
Write the shortest code that produces results as 1 without using any numbers in the select statement. using sql
September 20, 2012 at 9:34 am
One more
SELECT CAST(634 AS VARCHAR(2))
why it display * in result
September 20, 2012 at 9:36 am
PRINT 1
Doesn't use a SELECT statement 😉
Homework?
Andy
==========================================================================================================================
A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila. Mitch Ratcliffe
September 20, 2012 at 9:38 am
SELECT LEN('a')
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 20, 2012 at 9:40 am
GilaMonster (9/20/2012)
SELECT LEN('a')
ha, thats what i came up with 😀
September 20, 2012 at 9:40 am
One more
SELECT CAST(634 AS VARCHAR(2))
why it display * in result
Someone else also asked this
http://www.sqlservercentral.com/Forums/Topic1361763-149-1.aspx
==========================================================================================================================
A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila. Mitch Ratcliffe
September 20, 2012 at 9:40 am
vax09 (9/20/2012)
One moreSELECT CAST(634 AS VARCHAR(2))
why it display * in result
Overflow, you are trying to convert the number 634 to a string but only giving the string 2 characters of space where 3 are needed.
September 20, 2012 at 9:41 am
For this query
SELECT CAST(634 AS VARCHAR(2))
why it display * in result
September 20, 2012 at 10:27 am
Andy Hyslop (9/20/2012)
Someone else also asked thishttp://www.sqlservercentral.com/Forums/Topic1361763-149-1.aspx
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 20, 2012 at 11:00 am
vax09 (9/20/2012)
For this querySELECT CAST(634 AS VARCHAR(2))
why it display * in result
String truncation.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
September 20, 2012 at 12:08 pm
Now, now, Gentlemen. :rolleyes:
The questions posted here are from today's blog by Pinal Dave on SQLAuthority. You can ask any question, but perhaps some of us would like to compete as well. (Dave is offering a $50 Amazon.com gift card to the winner.)
For those interested, you can enter the competition here: http://blog.sqlauthority.com/
September 20, 2012 at 12:18 pm
Okay, these people should be disqualified.
September 20, 2012 at 12:21 pm
Somehow I think SELECT LEN('a') is too simple for Dave's competition. There must be some really obscure way of returning a 1.
I'm wracking my brain trying to think of what it might be. :unsure:
September 20, 2012 at 12:23 pm
David Moutray (9/20/2012)
Somehow I think SELECT LEN('a') is too simple for Dave's competition. There must be some really obscure way of returning a 1.I'm wracking my brain trying to think of what it might be. :unsure:
Why would you think that this would be too simple?
September 20, 2012 at 12:47 pm
This isn't that short, but at least it's obscure. :ermm:
select power('','')
Results:
----------------------
1
(1 row(s) affected)
Viewing 15 posts - 1 through 15 (of 46 total)
You must be logged in to reply to this topic. Login to reply