Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Get week no for the cuurent date between two dates Expand / Collapse
Author
Message
Posted Thursday, November 8, 2012 12:17 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, November 8, 2012 2:22 AM
Points: 1, Visits: 5
I have two dates , thats the week start date and end date . And i needs to know what is the week no for current between those dates . Is this possible ?
Post #1382290
Posted Thursday, November 8, 2012 12:53 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 6:58 AM
Points: 3,861, Visits: 5,003
Have you tried
DATEPART(WW, @Date)?

Refer DATEPART


____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
Post #1382301
Posted Thursday, November 8, 2012 1:18 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Today @ 12:27 AM
Points: 646, Visits: 1,853
sri.chithu.selva (11/8/2012)
I have two dates , thats the week start date and end date . And i needs to know what is the week no for current between those dates . Is this possible ?


This explanation is really poor. If you'd like us to spend our time helping you, please explain the problem, with examples where words are not working.
Post #1382315
Posted Thursday, November 8, 2012 7:29 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 7:56 PM
Points: 36,775, Visits: 31,230
sri.chithu.selva (11/8/2012)
I have two dates , thats the week start date and end date . And i needs to know what is the week no for current between those dates . Is this possible ?


What defines a "week number" at your company? For example, are you usig ISO week numbers, SQL week numbers, or some form of special "fiscal week" numbers? Are the start and end dates also the start and end dates of a single full week, a partial week, or do they span multiple weeks?

In any case, the best bet here would probably be to build a "Calendar Table". You can find many examples and some usage examples by doing a web search on the term.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1382491
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse