﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Issues with data format / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 23 May 2013 23:03:39 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Issues with data format</title><link>http://www.sqlservercentral.com/Forums/Topic1392503-391-1.aspx</link><description>[quote][b]kk.86manu (12/7/2012)[/b][hr]Thanks for your replyI just have one more clarificationIF '12/07/2012'&amp;lt;'12/01/2013' For the mentioned condition the first value is the same and second value is greater and again the condition should not satisfyIn this case how the comparison will occur.After the first string is compared will it compare the next 2 strings?[/quote]Are you looking at those string values as dates or strings?  As soon, and as told earlier, SQL will look at those as strings unless you convert them to dates using the CONVERT function.  As strings, '12/07/2012' &amp;lt; '12/01/2013' is false. If you sort them as strings it would look like this:'12/01/2013''12/07/2012'</description><pubDate>Fri, 07 Dec 2012 03:15:16 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: Issues with data format</title><link>http://www.sqlservercentral.com/Forums/Topic1392503-391-1.aspx</link><description>Thanks for your replyI just have one more clarificationIF '12/07/2012'&amp;lt;'12/01/2013' For the mentioned condition the first value is the same and second value is greater and again the condition should not satisfyIn this case how the comparison will occur.After the first string is compared will it compare the next 2 strings?</description><pubDate>Fri, 07 Dec 2012 01:37:32 GMT</pubDate><dc:creator>kk.86manu</dc:creator></item><item><title>RE: Issues with data format</title><link>http://www.sqlservercentral.com/Forums/Topic1392503-391-1.aspx</link><description>Or even this.[code]IF cast('12/04/2012' as datetime) &amp;lt; cast('03/01/2013' as datetime)select 1[/code]</description><pubDate>Tue, 04 Dec 2012 08:16:13 GMT</pubDate><dc:creator>Sean Lange</dc:creator></item><item><title>RE: Issues with data format</title><link>http://www.sqlservercentral.com/Forums/Topic1392503-391-1.aspx</link><description>Because you are comparing a string value against a string value and the first is not less than the second, you need to ensure you use the right data types.[code="sql"]declare @d1 date = '12/04/2012', @d2 date = '03/01/2013'if @d1 &amp;lt; @d2select 1[/code]</description><pubDate>Tue, 04 Dec 2012 08:06:31 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>Issues with data format</title><link>http://www.sqlservercentral.com/Forums/Topic1392503-391-1.aspx</link><description>Hello All,IF  '12/04/2012' &amp;lt; '03/01/2013select 1The above query is not fetching any result but if i use '&amp;gt;' condition it is giving me 1.Why?Kindly help</description><pubDate>Tue, 04 Dec 2012 07:54:11 GMT</pubDate><dc:creator>kk.86manu</dc:creator></item></channel></rss>