While writing T-SQL, you might face a problem where a user defined values (like date, datetime) has to be concatenated along with main sql. But in this case while concatenating , since date value is obtained as 2010-2-1. But in case of sql this is a int and cannot be compared to a date field hence has to be denoted date by including single quotes but since T-SQL is already a string, you might face some problem while writing query. Hence such special character has to be escaped and can be done as below:
This expression 12-4-2005
is a calculated int and the value is -1997
. You should do like this instead '2005-04-12'
with the '
before and after.