This is likely pretty simple, but I am a SQL newbie. I've been working around it for quite some time, but if I want things to be automatic, I need to figure little things like this out...
If I type this:
SELECT
CAST((CENTURY*1000000+YEAR*10000+MONTH*100+DAY)
AS VARCHAR(8))
AS DATE, ACCOUNT
FROM MASTER
WHERE CENTURY = 20 AND YEAR = 8 AND MONTH = 4 AND DAY = 1
I get a list looking like this:
DATE ACCOUNT
20080401 1000001
20080401 1000002
20080401 1000003
Is there any way to convert my new "DATE" into a date format? The columns are all numeric. I really don't need to change it to a varchar, and I don't really remember why I did so right now, so disregard it if you need to...
Thanks in advance...
If I type this:
SELECT
CAST((CENTURY*1000000+YEAR*10000+MONTH*100+DAY)
AS VARCHAR(8))
AS DATE, ACCOUNT
FROM MASTER
WHERE CENTURY = 20 AND YEAR = 8 AND MONTH = 4 AND DAY = 1
I get a list looking like this:
DATE ACCOUNT
20080401 1000001
20080401 1000002
20080401 1000003
Is there any way to convert my new "DATE" into a date format? The columns are all numeric. I really don't need to change it to a varchar, and I don't really remember why I did so right now, so disregard it if you need to...
Thanks in advance...