Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CAST Expression Error - Missing Operator

Posted on 1997-11-16
1
Medium Priority
?
591 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 100 total points
ID: 1089126
Hi,

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

(Hope this helped.)
Jim

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

963 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