"Dave R." <romeoinushotmail.com> wrote in message
news:0c7801c34726$18ab8890$a001280aphx.gbl...That query is trash.> Could anybody please answer me on this query:
> SELECT * FROM DBName..TableName
> where CONVERT(DATETIME,(CONVERT(CHAR(8),((CONVERT
> (INT,CONVERT(CHAR(8),XyzDate,112))) -
> XyzDateset)))) = '2002/11/14' and convert(varchar,XyzDate)
> not like '20000214.%'
> It returns:
> Server: Msg 241, Level 16, State 1, Line 1
> Syntax error converting datetime from character string.
It's not worth figuring out.
Throw it away, figure out what the query is supposed to do and rewrite it
using datediff, dateadd etc.
If you have trouble, post DDL and an explanation of what you need, and
you'll get help.