Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Day number of database

Author  Topic 

jql
Starting Member

30 Posts

Posted - 2010-05-17 : 06:39:24
Hi,

i have created a calendar script for work days but have noticed something very strange and would like some to understand the reasons.
when i run the script on my pc Saturday and Sunday are set to 0. however when my college opens the table Friday and Saturday are set to 0 and Sunday is set to 1. he is not running the script but just viewing. can anyone explain how this happens?

amitbarkai
Starting Member

19 Posts

Posted - 2010-05-17 : 07:18:26
well is is hard to tell you the answer without your script :)
to get the dat of week if i understand you correctly
you should use
the DatePart(dw ,getData())

another thing i can think of the the calander definitions on the server
for example is israel the week starts on sunday - 1 and ends on saturday - 7
while in the us moday - 1 ...

hope that help
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-05-17 : 07:18:46
it is probably due to different SET DATEFIRST value


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-05-17 : 08:32:51
See http://weblogs.sqlteam.com/peterl/archive/2009/01/14/Easy-script-for-calculating-weekday-or-weekend_for_a_date.aspx



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -