What will happen,if we run below query in query analizer?

Select Month('Rajesh') as 'Month';

 Posted by Rajesh_Kumar on 1/23/2014 | Category: Sql Server Interview questions | Views: 2059 | Points: 40
Answer:

It will throw below error as:
Msg 241, Level 16, State 1, Line 1
Conversion failed when converting date and/or time from character string.


Because as we know that,we can pass only Date values in Month function.But here we passed Text,so it will give us above error.
So always pass Date value to avoid exception.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response