Conversion failed when converting the varchar value xxx to data type int error

Posted by zurna on Stack Overflow See other posts from Stack Overflow or by zurna
Published on 2010-03-22T12:38:05Z Indexed on 2010/03/22 12:41 UTC
Read the original article Hit count: 252

Filed under:

I need to take data between certain dates. But I get the following error.

AdsDateStarted : 03/18/2010 01:51:38.000 AM AdsDateENded : 09/13/2010 05:00:00.000 PM

formatdate function converts today's date to 3/22/2010 format.

SQL = "SELECT * FROM Ads"
SQL = SQL & " WHERE AdsActive = 1 AND AdsAreasID = "& rtt &" AND CONVERT(VARCHAR(10), AdsDateStarted, 101) <= "& formatdate(Date()) &" AND CONVERT(VARCHAR(10), AdsDateEnded, 101) >= "& formatdate(Date()) &""
Set kdFonksiyon = objConn.Execute(SQL)

© Stack Overflow or respective owner

Related posts about sql-server