trudye10
Programmer
- Sep 8, 2006
- 67
I have a date that is stored as numeric in format yyyymmdd. I am trying to extrapolate the month from it and compare it to the current date. Is there a way to do a substring on a numeric field?
Here is my code:
I tried the CAST statement:
AND month(Getdate()) = substring(cast(ddbldt as char), 4, 2) but got no return records.
Is there another funciton I should be using
Thanx much,
Trudye
Here is my code:
Code:
SELECT
DDLOAN,
DDprod,
DDOFFR,
DDBLDT,
DDMFEE
FROM DMS_CONN.johnstd.AOFILES.DDTFEE AS DFEE
WHERE DFEE.[DDPROD] = '3000010000'
AND year(Getdate()) = left(ddbldt, 4)
AND month(Getdate()) = substring(ddbldt, 4, 2)
I tried the CAST statement:
AND month(Getdate()) = substring(cast(ddbldt as char), 4, 2) but got no return records.
Is there another funciton I should be using
Thanx much,
Trudye