Hello everyone,
How would I go about changing the Date format so my query can read it. The below example does not work but if I were to have a table with YYYYMMDD the below query does work. The query doesnt like dashes or forward slashes when working with date fields in certain tables - How can I say in my query
IF Date has dashes THEN change FROM 2007-08-01 to 20070801
or
IF Date has forward slashes THEN change FROM 8/01/2007 to 20070801
**** This does not work because of the dashes in the date
SELECT TOP 100 *
FROM AcctRecv
WHERE BillDate BETWEEN '2007-08-01' AND '2007-08-31'
ORDER BY BillDate
How would I go about changing the Date format so my query can read it. The below example does not work but if I were to have a table with YYYYMMDD the below query does work. The query doesnt like dashes or forward slashes when working with date fields in certain tables - How can I say in my query
IF Date has dashes THEN change FROM 2007-08-01 to 20070801
or
IF Date has forward slashes THEN change FROM 8/01/2007 to 20070801
**** This does not work because of the dashes in the date
SELECT TOP 100 *
FROM AcctRecv
WHERE BillDate BETWEEN '2007-08-01' AND '2007-08-31'
ORDER BY BillDate
Comment