# SQL SERVER – 2 T-SQL Puzzles and Win USD 50 worth Amazon Gift Card and 25 Other Prizes

We all love brain teasers and interesting puzzles. Today I decided to come up with 2 interesting puzzles and winner of the contest will get USD 50 worth Amazon Gift Card. The puzzles are sponsored by NuoDB. Additionally, The first 25 individuals who download NuoDB Beta 8 by midnight Friday, Sept. 21 (EST) will automatically receive a \$10 Amazon gift card.

### Puzzle 1:

Why following code when executed in SSMS displays result as a * (Star)?

`SELECT CAST(634 AS VARCHAR(2))`

### Puzzle 2:

Write the shortest code that produces results as 1 without using any numbers in the select statement.

### Bonus Q:

How many different Operating System (OS) NuoDB support?

If you can solve above puzzles you will be eligible for winning USD 50 Amazon Gift Card. However, you can always enroll yourself for following Bonus Prizes where if you have good chance of winning USD 10 Amazon Gift Card (if you are first 25 individual in specific time).

### Bonus Prizes:

The first 25 individuals who download NuoDB Beta 8 by midnight Friday, Sept. 21 (EST) will automatically receive a \$10 Amazon gift card.

### Rules:

• You can resubmit your answer multiple times, the latest entry will be considered valid.
• The winner will be announced on 1st October.
• Last day to participate in the puzzle is September 28th, 2012.
• All valid answer will be kept hidden till September 28th, 2012.
• Only One Winner will get USD 50 worth Amazon Gift Card.
• The first 25 individuals who download NuoDB Beta 8 by midnight Friday, Sept. 21 (EST) will automatically receive a \$10 Amazon gift card.
• The winner will be selected using random algorithm.

UPDATE: The winner of the contest is Jaime Mtnz Lafargue (@jaimeml)

Reference: Pinal Dave (https://blog.sqlauthority.com)

## SQLAuthority News – Sharding or No Sharding of Database – Working on my Weekend Project

• SELECT ’1′

the reason for using ’1′ (and I got some slack for using ’1′) is because technically ’1′ is NOT a number it is a char! so select ’1′ does reproduce the requested output, and if you where using ado to set to int sql server likes to do something called implicit casting.

• Hi All,

We thank you for your kind participation. Here is the winner of Amazon USD 50 Gift Card

Jaime, please send me email at pinal at SQLAuthority.com .

We thank you for your participation and appreciate your support. We will come up with another interesting puzzle very soon!

Kind Regards,
Pinal

• Đoàn Thanh Sa
October 3, 2012 12:12 pm

Hi pinaldave. Why is my answer not correct? I answer sooner than Jaime.

“This is my answer. Question 1: When converting number to character type, the result display * if result length too short to display.
Question 2: select cos(\$)”

• Hi Doan,

It is not about one answer correct and another not correct. We put all the good answers in a single table and selected random winner. As there was one winner Jaime got selected.

I have personally great respect for your answer too. As I said it is a randomly picked correct answer. Additionally there was the deadline to submit the answer – this means all the answers are equally eligible irrespective to when it was submitted.

I hope you understand.

Kind Regards,
Pinal

• Jaime Mtnz Lafargue (@jaimeml)
October 6, 2012 4:39 pm

Hi all,

Thank You Pinal, NuoDB and everybodoy involved.

Kind Regards,

Jaime

• ARUNAGIRI GOPAL
May 27, 2016 4:26 pm

select count(*)