Forum Replies Created

Viewing 9 posts - 1 through 9 (of 9 total)

  • RE: Compare Table date with current date

    Christopher Stobbs (4/21/2009)


    just remember that your solution does not take into account time.

    so for example if you run the query at 2009-04-21 16:38.59

    Then anything before 16:38.59 on the 2009-04-14 will...

  • RE: Compare Table date with current date

    Christopher Stobbs (4/21/2009)


    Could you post the solution?

    this will help any others searching for a similar solution 🙂

    well I just did this.

    where table.column1 = 'xxx' and (column2 between getdate() -7 and...

  • RE: Compare Table date with current date

    Christopher Stobbs (4/21/2009)


    I agree 100% 🙂 I think the tools for your solution have now been provided and working out the last part will provide a good learning platform for...

  • RE: Compare Table date with current date

    Christopher Stobbs (4/21/2009)


    ok here is break down of the code:

    --Month

    WHERE [YourDate] BETWEEN

    DATEADD(mm, DATEDIFF(mm,0,DATEADD(mm,-1,GETDATE())), 0)

    AND DATEADD(ms,-3,DATEADD(mm, DATEDIFF(mm,0,GETDATE()), 0))

    The from part of the date:

    Step 1: DATEADD(mm,-1,GETDATE() = get the date...

  • RE: Compare Table date with current date

    Christopher Stobbs (4/21/2009)


    this should work according to your criteria:

    --Month

    WHERE [YourDate] BETWEEN

    DATEADD(mm, DATEDIFF(mm,0,DATEADD(mm,-1,GETDATE())), 0)

    AND DATEADD(ms,-3,DATEADD(mm, DATEDIFF(mm,0,GETDATE()), 0))

    --Year

    WHERE [YourDate] BETWEEN

    DATEADD(yy, DATEDIFF(yy,0,DATEADD(yy,-1,GETDATE())), 0)

    AND DATEADD(ms,-3,DATEADD(yy, DATEDIFF(yy,0,GETDATE()), 0))

    Just so you know...

  • RE: Compare Table date with current date

    Christopher Stobbs (4/21/2009)


    When you say last year and last month .

    Do you mean the following

    today's date = 23/03/2009

    Therefore Last year = any day in 2008

    Therefore Last month = andy...

  • RE: Compare Table date with current date

    ShuaThe2nd (4/21/2009)


    Hi there,

    The following select statement should give you the dates you are after;

    SELECT DATEADD(YYYY, -1, DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), 0)) AS [Last Year],

    DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), 0) AS...

  • RE: Compare Table date with current date

    Christopher Stobbs (4/21/2009)


    Look up on BOL for the following datetime functions

    DATEADD()

    DATEDIFF()

    see how you get on...

    I have already tryied that, but no luck, can't manage to get it working. can you...

  • RE: Extract users from Active Directory using SSIS

    yes, i already implemented that, but I having problems editing the code to add this costum fields, as i said I not a developer, and the code development is very...

Viewing 9 posts - 1 through 9 (of 9 total)