Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2003
    Posts
    7

    Unanswered: DatePart problem

    Can anyone explain me why this query

    SELECT DATEPART(dw, CONVERT(DATETIME, '2001-01-25 01:00:00', 120))

    returns 5 on one SQLServer, and 4 on another one. It cannot be a regional settings problem because 25 could never be a month. Any way, is there a deterministic way to create a DATE regardless of the server's regional settings?

    I mean, I have the year, month and day... how do I tell the server "This is the year; This is the month; This is the day... convert this into a DATE, and the tell me which day of the week is"??

    TIA,
    Last edited by Mc Brain; 11-03-04 at 09:42.

  2. #2
    Join Date
    Mar 2003
    Posts
    7
    I think I've figured it out... I'll post again if I need further help.

  3. #3
    Join Date
    Jul 2003
    Posts
    123
    And the solution was? *curious*

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'll bet on SET DATFIRST.

    -PatP

  5. #5
    Join Date
    Mar 2003
    Posts
    7
    Quote Originally Posted by Pat Phelan
    I'll bet on SET DATFIRST.

    -PatP
    Good bet! You were right. That was the solution I had found out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •