Creating date field

jbphoenix

Registered User.
Local time
Today, 01:37
Joined
Jan 25, 2007
Messages
98
I've created an ssis package that does some importing and manipulation. I need to put the last day of the month in my date field. The process is run once a month and no matter when it's run I need to put in the last day of the month. The queries below will give me the last day of the month. How would I combine these to make my date field look like this 20090531?

select year(dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate() )+1,0)))

select month(dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate() )+1,0)))

select day(dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate() )+1,0)))
 

Users who are viewing this thread

Back
Top Bottom