Problem with SET DATEFIRST in a View

  • Hi

    I need to place SET DATEFIRST 1 in a view I am creating as I am based in the UK, where Monday is the start of the week.

    I am not being allowed to create the view and SET DATEFIRST to 1, has anyone got any ideas on how to tackle this?

  • adnaan.afzal (8/19/2008)


    Hi

    I need to place SET DATEFIRST 1 in a view I am creating as I am based in the UK, where Monday is the start of the week.

    I am not being allowed to create the view and SET DATEFIRST to 1, has anyone got any ideas on how to tackle this?

    You cannot set datefirst for views, so either you set it every time you query this view, or stop relying on DATEFIRST.You can write your own function to handle the functionality you need, and can do automatic compensation by querying the @@DATEFIRST variable.

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • An example is on:

    http://www.eggheadcafe.com/software/aspnet/29116616/weeknumber.aspx

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • Thanks Andras

    You gave me the inspiration for solving this problem. I have placed the DATEFIRST in DTS that exports the data to Excel and it works.

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

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