Solved

CAST Expression Error - Missing Operator

Posted on 1997-11-16
1
565 Views
Last Modified: 2012-05-04
I am getting the following error when executing a CAST in my SQL statement:
[ODBC][Microsoft dBase Driver]Syntax Error (missing operator) in query 'CAST (STARTDATE AS DATE)'

My SQL statement is:
SELECT CAST (STARTDATE AS DATE) AS ENDDATE FROM {Table}

According to all my books, this is correct.  STARTDATE is a
date in string format (mm/dd/yy)  What "missing operator" is the MS driver looking for?

Thanks!
 -Brent
0
Comment
Question by:da5id111697
1 Comment
 
LVL 2

Accepted Solution

by:
Jim_SQL earned 50 total points
ID: 1089126
Hi,

TRY:
select convert(datetime, STARTDATE) as EndDate
from TableName

(Hope this helped.)
Jim

0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question