Results 1 to 6 of 6

Thread: [RESOLVED] Date Formatting in SQL 2005

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    Resolved [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"

  2. #2
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    Re: Date Formatting in SQL 2005

    do you mean this

    Code:
    select dateadd(day,2,getdate())
    __________________
    Rate the posts that helped you

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    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"

  4. #4
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,875

    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

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    Re: Date Formatting in SQL 2005

    Okay, thanks I'll give this a go!
    Tuber

    "I don't know the rules"

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    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
  •  



Click Here to Expand Forum to Full Width