Home > Archive > SQL Anywhere database > December 2005 > DOW - not changing after option changes first_day_of_week to 1









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author DOW - not changing after option changes first_day_of_week to 1
Hans Peter Oechslin

2005-12-22, 3:23 am

ASA Version 9.0.2.3207

After setting the database option first_day_of_week to 1 (Monday) I still
get 2 for 2005-12-19

select dow('2005-12-19') Result: 2

Circumstances:
I have to convert a Stored Procedure from MS SQL to ASA. In SQLServer I
just have to use SET datefirst 1 to get the required result.

Is there a solution to solve this without writing a function to correct
that behaviour?

Any help appreciated.

Hans Peter Oechslin
Mark Culp

2005-12-22, 8:24 pm

The DOW() function does not use the first_day_of_week option.

Change your query to
select datepart( weekday, '2005-12-19' )
and you will get what you expect.
--
Mark Culp
SQLAnywhere Research and Development
-------------------------------------------------------------------------
** Whitepapers, TechDocs, bug fixes are all available through the **
** iAnywhere Developer Community at http://www.ianywhere.com/developer **
-------------------------------------------------------------------------
Hans Peter Oechslin wrote:
>
> ASA Version 9.0.2.3207
>
> After setting the database option first_day_of_week to 1 (Monday) I still
> get 2 for 2005-12-19
>
> select dow('2005-12-19') Result: 2
>
> Circumstances:
> I have to convert a Stored Procedure from MS SQL to ASA. In SQLServer I
> just have to use SET datefirst 1 to get the required result.
>
> Is there a solution to solve this without writing a function to correct
> that behaviour?
>
> Any help appreciated.
>
> Hans Peter Oechslin

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com