In my database I have a birthdate field, type decimal. Example of a record would be 19721003, i.e. 10/03/1972. I am using the following syntax where $whatMonth = '10'. Ulitmately, I want to pull out all the records with a birthday in a specific month, then order them by day:
This is not working and I have tried CAST as well but no luck with that. I am sure it is just that I don't know the exact syntax. Any help would be great.
Code:
SELECT lastname, altaddr1, altaddr2, altaddr4, altcntry, CONVERT(birthdate, SQL_CHAR) FROM SOINC.UPEMPL where status <> 3 CONVERT(SUBSTRING(birthdate,5,2), SQL_INTEGER) = '$whatMonth'