Question
Bizzare error - datasource and getdate not returning correct day of week
Hi,
This is on CFMX 7.0.2,142559.
I have a data source pointing to a MS SQL server. There is a simple query that access a date off the database and extract the values of:
-. Current timestamp
-. Day of week
-. First day of week
The query has been running for years and suddenly it gives me the wrong Day of week and First day of week, but the timestamp is correct! The result of the calculation for the Day of Week suddenly became one day ahead, the @@DATEFIRST switched between 6 and 7 (being 7 as the correct value).
Here is the code:
<cfquery name="dte0" datasource="test123"
SELECT getdate() dte, DATEPART(dw, getdate()) dteDW, @@DATEFIRST dteFirst, @@language LanguageVersion
</cfquery>
<cfdump expand="Yes" label="Query Dump" var="#dte0">
I tried to delete and recreate this data source, restart CF and flush the cache with no success. The really bizarre thing is for a few minutes after I restart CF, it returnes the correct data, but then it suddenly moves one day ahead - and again, only the Day of week. The DATEFIRST sometimes returns 6 (instead of the correct value of 7) The timestamp is ALWAYS correct.
I then created a second data source with exactly the same parameters and named it "test456" and it works perfectly every time!!
I am baffled as how this happened and how to fix it.
Does anyone know if somehow the datasource "test123" is cached somewhere? Appreciate any advice/suggestions/ideas.
Aditya.
This is on CFMX 7.0.2,142559.
I have a data source pointing to a MS SQL server. There is a simple query that access a date off the database and extract the values of:
-. Current timestamp
-. Day of week
-. First day of week
The query has been running for years and suddenly it gives me the wrong Day of week and First day of week, but the timestamp is correct! The result of the calculation for the Day of Week suddenly became one day ahead, the @@DATEFIRST switched between 6 and 7 (being 7 as the correct value).
Here is the code:
<cfquery name="dte0" datasource="test123"
SELECT getdate() dte, DATEPART(dw, getdate()) dteDW, @@DATEFIRST dteFirst, @@language LanguageVersion
</cfquery>
<cfdump expand="Yes" label="Query Dump" var="#dte0">
I tried to delete and recreate this data source, restart CF and flush the cache with no success. The really bizarre thing is for a few minutes after I restart CF, it returnes the correct data, but then it suddenly moves one day ahead - and again, only the Day of week. The DATEFIRST sometimes returns 6 (instead of the correct value of 7) The timestamp is ALWAYS correct.
I then created a second data source with exactly the same parameters and named it "test456" and it works perfectly every time!!
I am baffled as how this happened and how to fix it.
Does anyone know if somehow the datasource "test123" is cached somewhere? Appreciate any advice/suggestions/ideas.
Aditya.
