How to remove dates from a date without returning nothing

  • I'm trying to write a query that will automatically determine our process dates so I don't have to manually input them all each day I run it. The problem is I need to remove weekends and holidays. I've written this thinking I would provide a list of holiday and weekend dates to be ignored/skipped:

    select convert(char,getdate()-1,101)

    where convert(char,getdate()-1,101) not in ('06/30/2008')

    However, this returns no value and I need it to return 6/29/2008. How can I rewrite this or is there a better/simpler way to go about this?

  • Ok, seriously, I'm not as stupid as the topic statement makes me seem, though apparently I'm too stupid to edit it.

  • All right....I'll spare you the comment (been there done that got the Duhh t-shirt on right now!)...

    that being said - I'm thinking you want to read through this article - should give you plenty of ammo to work with....

    http://www.sqlservercentral.com/articles/Advanced+Querying/calculatingworkdays/1660/%5B/url%5D

    And this one:

    http://www.sqlservercentral.com/Forums/Topic409200-338-1.aspx

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • You Failed.Face!

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

You must be logged in to reply to this topic. Login to reply