Visual studio feeds

All Visual Studio blogs in one place

Subscribe

Enter your email address:

Delivered by FeedBurner

Increase your website traffic with Attracta.com

Google+

Contact

Email:
Subject:
Message:
Anti-spam: How many eyes has a typical person?

Follow us on FB

Search

Question of the month June 2012 - Explain the result of Date+Date

AddThis Social Bookmark Button
My friend asked me to come up with very triky interview question which is not usually asked. I myself asked this question to some of candidates while interviewing. It is possible to to apply arithmetic operators + and - on date columns like Date+2, Date-5 etc. Have you ever used Date+Date to know what it returns? Consider the following exampledeclare @date datetime set @date='20000101' select @date+@date as result When I asked what it would return, candidates gave many answers. Some of them are 1 40000202
2 40000101
3 40000102

I guessed that all they thought was it was like addition on numbers. But the answer is
2099-12-31 00:00:00.000

Ok. Here is the question. What is the logic used behind that answer?

Note : Also replace 20000101 by 19000101 to confirm if you are correct....(Read whole news on source site)

Home : Blog List : Madhivanan's TSQL Blog : Question of the month June 2012 - Explain the result of Date+Date