MSSQL - getting time different excluding weekends

Hi, I am doing an ms sql select but i want to exclude week ends as i want am doing a different bewteen when a product was sold and when payment was done I need the diffrent between the sold date and paid date excluding weekends Any idea is highly appreciated Regards -- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us. Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo

Seems you have to use a function. Check out http://stackoverflow.com/questions/2258767/calculating-how-many-working-days... On Mon, Aug 16, 2010 at 2:57 PM, Calvin Omari <calvinebarongo@gmail.com>wrote:
Hi, I am doing an ms sql select but i want to exclude week ends as i want am doing a different bewteen when a product was sold and when payment was done I need the diffrent between the sold date and paid date excluding weekends
Any idea is highly appreciated
Regards -- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us.
Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke

Awesome, Exactly what i needed On Mon, Aug 16, 2010 at 3:01 PM, Edwin Kaduki <kaduki@edwinkaduki.com>wrote:
Seems you have to use a function. Check out http://stackoverflow.com/questions/2258767/calculating-how-many-working-days...
On Mon, Aug 16, 2010 at 2:57 PM, Calvin Omari <calvinebarongo@gmail.com>wrote:
Hi, I am doing an ms sql select but i want to exclude week ends as i want am doing a different bewteen when a product was sold and when payment was done I need the diffrent between the sold date and paid date excluding weekends
Any idea is highly appreciated
Regards -- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us.
Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us. Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo

Also http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=26908 On Mon, Aug 16, 2010 at 3:31 PM, Calvin Omari <calvinebarongo@gmail.com>wrote:
Awesome, Exactly what i needed
On Mon, Aug 16, 2010 at 3:01 PM, Edwin Kaduki <kaduki@edwinkaduki.com>wrote:
Seems you have to use a function. Check out http://stackoverflow.com/questions/2258767/calculating-how-many-working-days...
On Mon, Aug 16, 2010 at 2:57 PM, Calvin Omari <calvinebarongo@gmail.com>wrote:
Hi, I am doing an ms sql select but i want to exclude week ends as i want am doing a different bewteen when a product was sold and when payment was done I need the diffrent between the sold date and paid date excluding weekends
Any idea is highly appreciated
Regards -- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us.
Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us.
Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo
-- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us. Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo

Dont know about mssql but in mysql there is a function like dayofweek So select becomes Select xxxxxx from abcd where x=y and y=z and dayofweek(datecolumn) not in (6,7) From: Calvin Omari [mailto:calvinebarongo@gmail.com] Sent: 16 August 2010 1:58 p To: Skunkworks Forum Subject: [Skunkworks] MSSQL - getting time different excluding weekends Hi, I am doing an ms sql select but i want to exclude week ends as i want am doing a different bewteen when a product was sold and when payment was done I need the diffrent between the sold date and paid date excluding weekends Any idea is highly appreciated Regards -- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us. Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo

The equivalent SQL Server function is datepart, passing as parameters the date part you want, in this case weekday as 'dw' and the actual date On Mon, Aug 16, 2010 at 4:54 PM, Chris | Ronell Africa < chris@ronellafrica.com> wrote:
Dont know about mssql but in mysql there is a function like dayofweek
So select becomes
Select xxxxxx from abcd where x=y and y=z and dayofweek(datecolumn) not in (6,7)
*From:* Calvin Omari [mailto:calvinebarongo@gmail.com] *Sent:* 16 August 2010 1:58 p *To:* Skunkworks Forum *Subject:* [Skunkworks] MSSQL - getting time different excluding weekends
Hi, I am doing an ms sql select but i want to exclude week ends as i want am doing a different bewteen when a product was sold and when payment was done I need the diffrent between the sold date and paid date excluding weekends
Any idea is highly appreciated
Regards -- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us.
Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
participants (4)
-
Calvin Omari
-
Chris | Ronell Africa
-
Edwin Kaduki
-
Rad!