Wednesday, May 30, 2007

SELECT "YYYYDD" datetime

Can you explain about this ?

1st sql script :

SELECT CONVERT(VARCHAR(6),GETDATE(), 112)

------
200705

(1 row(s) affected)


2nd sql script :

SELECT CONVERT(VARCHAR(4),YEAR(GETDATE()), 112) + CONVERT(VARCHAR(2),MONTH(GETDATE()), 112)

------
20075

(1 row(s) affected)


Why 2nd sql script doesn't show the same result with the 1st sql script ?

No comments: