I thought the CAST function might be my problem.
Yes, I am running this on a SQL table. I have it linked through an ODBC connection.
I tried to run the query by creating new query (design), closing the show table window without picking any tables and then clicking on SQL View. I then pasted...