Board index » delphi » Date Functions in Delphi 4 CS and SQL 6.5

Date Functions in Delphi 4 CS and SQL 6.5

I have an application which was using Interbase 5.0 as the backend. I have
now switched it to use SQL Server 6.5 and my queries wont run. One query is
a paramtized query and I believe the problem is with the keyword "NOW"
which was used by Interbase to retrieve the current date. Does anyone know
what the function would be in SQL server.

Here is the error message:

General Error
[Microsoft][ODBC SQL Server Driver][SQL Server] syntax erroe converting
DATETIME from character string.

Here is the SQL statement used in INTERBASE:

select css_start_date,  css_course_name, css_prereq_no,
css_student_allow, css_students,css_start_time, css_end_time,
css_sched_course, css_end_date
from COURSE, SCHEDULE
where css_course_name >= :CNAME and
css_start_date >= 'now' and
css_sched_course = css_course_no
order by css_course_name, css_start_date;

Please help.

All responses can be posted or mailed directly to pjack...@albemarle.org

 

Re:Date Functions in Delphi 4 CS and SQL 6.5


Quote
>css_start_date >= 'now' and

Assuming that css_start_date is a date field, you certainly can't
compare it to the string literal 'now'.  Perhaps you need another
query parameter here.  

You could also take advantage of the built-in (to MS-SQL) date
function:

 css_start_date >= GetDate()

-Mike

Other Threads