[RESOLVED] Date Formatting in SQL 2005
I have a SSIS package that pulls data by SQL query and creates an Excel spreadsheet. However I'm having trouble formatting the date range it pulls by. It's going to run every monday and I need to it to pull the date range for the previous week. I've found how to do DateAdd but I'm not sure how to use it in conjunction with the current date.
Any help would be great! Thanks.
Re: Date Formatting in SQL 2005
do you mean this
Code:
select dateadd(day,2,getdate())
Re: Date Formatting in SQL 2005
WHERE (date >= dateadd(day,-7,getdate())) AND (date < getdate())
This would probably work wouldn't it?
Re: Date Formatting in SQL 2005
dateadd(day,-1,getdate()) will also include the Time part which i think you might want to handle ?
Re: Date Formatting in SQL 2005
Okay, thanks I'll give this a go!
Re: Date Formatting in SQL 2005
That'll work, thanks so much!