Highlighted

The data types time and datetime are incompatible in the equal to operator?

Community Beginner ,
Dec 10, 2015

Copy link to clipboard

Copied

I have my simple cfquery that should delete records base on the date, start time and end time that have been passed with the arguments. My cfquery looks like this:

<cfquery name="qryDelete" datasource="test">
  
Delete From Table
  
Where DateS = <cfqueryparam cfsqltype="cf_sql_date" value="#arguments.DateSch#">
  
and Start = <cfqueryparam cfsqltype="cf_sql_time" value="#arguments.Stime#">
  
and End = <cfqueryparam cfsqltype="cf_sql_time" value="#arguments.Etime#">
</cfquery>


I tried to output my argument values, they look like this:

DateSch
12/10/2015
Etime 
08:25 AM
Stime 
08:00 AM


For some reason after I tried to delete records I got an error that looks like this:

"The data types time and datetime are incompatible in the equal to operator"


I'm wondering why my date and times can not be compared with values in database. Should I convert or format my argument values differently before I pass them in my cfquery for deletion?

If anyone knows how this can be fixed please let me know. Thanks in advance.

Views

774

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

The data types time and datetime are incompatible in the equal to operator?

Community Beginner ,
Dec 10, 2015

Copy link to clipboard

Copied

I have my simple cfquery that should delete records base on the date, start time and end time that have been passed with the arguments. My cfquery looks like this:

<cfquery name="qryDelete" datasource="test">
  
Delete From Table
  
Where DateS = <cfqueryparam cfsqltype="cf_sql_date" value="#arguments.DateSch#">
  
and Start = <cfqueryparam cfsqltype="cf_sql_time" value="#arguments.Stime#">
  
and End = <cfqueryparam cfsqltype="cf_sql_time" value="#arguments.Etime#">
</cfquery>


I tried to output my argument values, they look like this:

DateSch
12/10/2015
Etime 
08:25 AM
Stime 
08:00 AM


For some reason after I tried to delete records I got an error that looks like this:

"The data types time and datetime are incompatible in the equal to operator"


I'm wondering why my date and times can not be compared with values in database. Should I convert or format my argument values differently before I pass them in my cfquery for deletion?

If anyone knows how this can be fixed please let me know. Thanks in advance.

Views

775

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 10, 2015 0
Advocate ,
Dec 11, 2015

Copy link to clipboard

Copied

Are the data types in the database actually "date" and "time". Are you sure they are not "datetime" or "timestamp"?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2015 0
Community Beginner ,
Dec 11, 2015

Copy link to clipboard

Copied

Date is Data Type date, Start time is Data Type time(7) and End time is Data Type time(7).

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2015 0
Most Valuable Participant ,
Dec 12, 2015

Copy link to clipboard

Copied

Might help to know what DBMS platform you are working with.

-Carl V.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 12, 2015 0