|
-
Jul 21st, 2008, 10:14 AM
#1
Thread Starter
Hyperactive Member
[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.
Tuber
"I don't know the rules"
-
Jul 21st, 2008, 10:17 AM
#2
Re: Date Formatting in SQL 2005
do you mean this
Code:
select dateadd(day,2,getdate())
__________________
Rate the posts that helped you 
-
Jul 21st, 2008, 10:21 AM
#3
Thread Starter
Hyperactive Member
Re: Date Formatting in SQL 2005
WHERE (date >= dateadd(day,-7,getdate())) AND (date < getdate())
This would probably work wouldn't it?
Tuber
"I don't know the rules"
-
Jul 21st, 2008, 10:26 AM
#4
Re: Date Formatting in SQL 2005
dateadd(day,-1,getdate()) will also include the Time part which i think you might want to handle ?
__________________
Rate the posts that helped you 
-
Jul 21st, 2008, 10:28 AM
#5
Thread Starter
Hyperactive Member
Re: Date Formatting in SQL 2005
Okay, thanks I'll give this a go!
Tuber
"I don't know the rules"
-
Jul 21st, 2008, 10:35 AM
#6
Thread Starter
Hyperactive Member
Re: Date Formatting in SQL 2005
That'll work, thanks so much!
Tuber
"I don't know the rules"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|