I’ll throw this question out there:
I have been trying to get a select statement that formerly worked in Access to work in SQL….I know that the application used the Access date delimiter # , and say that ‘ is used for SQL ….but simply plugging in ‘ in place of the # in the DB_DATE_DELIMITER variable does not do the trick……the SQL that will not go through in the SQLServer database is as follows:
SELECT * FROM messages WHERE forum_id=4 AND thread_parent=0 AND ‘2/14/2004 12:00:00 AM’ < message_timestamp AND message_timestamp < '2/21/2004 12:00:00 AM' ORDER BY thread_id DESC; what do I need to add to this line to make this play nice with SQLServer? Set objMessageRS = GetRecordset("SELECT * FROM messages WHERE forum_id=" & iActiveForumId & " AND thread_parent=0 AND " & DB_DATE_DELIMITER & FormatTimestampDB(dStartDate) & DB_DATE_DELIMITER & " < message_timestamp AND message_timestamp < " & DB_DATE_DELIMITER & FormatTimestampDB(dEndDate) & DB_DATE_DELIMITER & " ORDER BY thread_id DESC;") where DB_DATE_DELIMITER = "'" instead of the "#" which worked in Access (I already tried removing the ; from the end of the SQL statement) this is the error I get when I try to execute the page: Error Type: Microsoft OLE DB Provider for SQL Server (0x80040E14) Incorrect syntax near the keyword 'AND'. Any suggestions, for any of you SQLServer gurus or "more-guru-like than I am" ?