Puzzle: Write a Shortest Code to Produce Zero.

It has been a long time since we have puzzle on this blog. So I have decided to post this puzzle. You have to write a shortest code which produces digit 0 (zero).
If you think this puzzle is easy, it is not true. I have two very simple but interesting condition for you.
Condition 1: Do not use numbers and arithmetic calculation
Condition 2: Do not use 0 in the code
Condition 3: Do not use function len()
Well, that’s it. So if you were thinking to write code like SELECT 1-1 or PRINT 0 or SELECT LEN(”). You can’t do that. You are not allowed to use numbers, arithmetic calculation or the digit 0 in the code.
Let me show you one valid solution.
SELECT ISDATE('a')Now, here is the challenge for you. The above code produces the result 0 (zero) and the length of the code is 18.
Here is the final condition for you,
Condition 4: Your Solution should have length lesser than 18 characters.
Now think of the interesting solution and post the result in the comment.
I will be happy to see what you can come up with. If you are also subscribed to my newsletter at https://blog.sqlauthority.com/contact-me/sign-up/ please expect a surprise gift for you if you get the correct answer.
Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.






727 Comments. Leave new
SELECT ISNUMERIC(null)
Select isdate(”)
SELECT ISNUMERIC(”)
print @@TRANCOUNT
SELECT CHAR(48)
Condition 1… ;)
print @@error
Select isnumeric(‘A’)
SELECT sin(0)
You used 0
SELECT ISDATE(”)
select pi()-pi()
Not the shortest posted, but a bit different …
SELECT”&@@IDLE
returns int 0
SELECT”&@@SPID
returns smallint 0
Not sure if PRINT is permitted, but that works too.
he mentions it on the description PRINT 0 is not allowed because the 0 not the PRINT it selft
PRINT ABS(”)
PRINT SIN(\)
— Result 0 (zero). Code length 12.
— Currency symbols for the SIN argument also return zero. Like…
PRINT SIN($) — Mexican Peso
— and others
PRINT SIN($) — US Dollar
PRINT SIN(£) — UK Pound
— etc…
I got 6!
PRINT\
6 characters
I presume a statement of 1 character should win this?
;
Run that semi colon and you get “Commands completed successfully.”