Oh, ok, you've got an error meaning that some of the data that you are converting actually is not date information. Maybe you could do this:
Where ... And isdate(substring(demographicvaluedesc,1,11)) is true Matthew Small IT Director Showstopper American Dance Championships [EMAIL PROTECTED] 843-357-1847 -----Original Message----- From: Eric Creese [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 2:57 PM To: CF-Talk Subject: RE: SQL DATE CONVERSION QUESTION Yes I tried this, same error. -----Original Message----- From: Marlon Moyer [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 1:46 PM To: CF-Talk Subject: Re: SQL DATE CONVERSION QUESTION Have you tried using Cast instead of Convert, ie My query: select personid from persondemographic where cast(substring(demographicvaluedesc,1,11) as datetime) > '06/30/2003' and demographicgroupid =4 and demographicitemid = 4 and demographicvaluedesc is not null Marlon Eric Creese wrote: >No SQL Gurus out there? > >-----Original Message----- >From: Eric Creese >Sent: Tuesday, July 01, 2003 7:49 AM >To: CF-Talk >Subject: RE: SQL DATE CONVERSION QUESTION > > >Can anyone see what I am doing wrong? If I use the convert statement in the select clause instead of the where clause it works but I need to convert from the where clause against my criteria. > >-----Original Message----- >From: Eric Creese >Sent: Monday, June 30, 2003 5:24 PM >To: CF-Talk >Subject: SQL DATE CONVERSION QUESTION > > >I am trying to query on a field that is a varchar(255) but has date information. > >I get the following error: >Server: Msg 241, Level 16, State 1, Line 1 >Syntax error converting datetime from character string. > >My query: >select personid >from persondemographic >where convert(datetime,substring(demographicvaluedesc,1,11),101)> '06/30/2003' >and demographicgroupid =4 >and demographicitemid = 4 >and demographicvaluedesc is not null > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4