Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    104

    Exclamation Unanswered: Strange sp behavior when it runs with its name

    Hi,
    I have a very strange problem. The behavior of SQL server 2000 is very strange.
    I have a sp that when it runs with its name brings different (wrong) results than when running the sql code itself!!!
    The sp creates and fills a table through a select into sql command. A field of the table is a date field. This field is filled up with a date from the select command to another table. Because this date field (CREATED) is UTC (universal time) we need to store it in the new table (tbl) as local date/time. For this reason we found an sql function (GetLocalDateTime) that do this very well (also includes the change in DST-daylight saving). Thus we have "select GetLocalDateTime(CREATED) into tbl".
    The strange behavior is that when this sql code runs itself we get the right results for all date/time records but when it runs through a sp then we have all the records with the right local time except the records with date 30/10/2011 only. These records are one hour ahead!!!!!!! For all days before and after this day the results are ok!!!
    This date is the date that we changed our clocks one hour back!

    Thanks in advance

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,799
    Provided Answers: 11
    GetLocalDateTime does not seem to be a native SQL Server 2000 function. Do you have the code for it? Perhaps it is changing DST a week off, or something.

  3. #3
    Join Date
    Feb 2004
    Posts
    104
    The case was closed. The problem was a SET DATEFIRST 1 that I had in the begging of the sp. The custom Function supposed 7.
    Thanks any way.

Tags for this Thread

Posting Permissions

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