:::: MENU ::::

Call it ad-hoc or out of box thinking

  • Jan 07 / 2010
  • 1
dbDigger, T-SQL Interview Questions, T-SQL Tips and Tricks

Call it ad-hoc or out of box thinking

Although is does not always work but, some times ad-hoc thinking makes the solution very simple. Consider the following scenario for which a very simplified solution is provided for. We may call it out of box thinking as well.

Is there a condition for the WHERE clause to display the details about the students born in the month numbers of 1[Jan], 3,4,5,7,8? The condition should not use both IN and OR operators.

Answer: Yes

Explanation: We can give the condition as follows:
where datename(m,dob) not like ‘%e%’
because these month(s) specified do not have the letter ‘e’, but all the other months have at least one ‘e’ in month name.

Note: The question of day is taken from SqlServerCentral.com. I want to compile selected QOD to share.

  • Anonymous


    i have a two database like testDB and testDB1. both DB table names like table for testDB and table1 for testDB1 and field name also same for both tables.

    Now i need ur help.. ie..I have .bak file in my system when i restore this .bak file in testDB at the same time all the fields are update to testDB table1.. if it is possible pls guid me and send code…

    Thanking u..

Consult us to explore the Databases. Contact us