> 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 and First day of week
suddenly became one day
> ahead.
>
> 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">
When CF encouters the string within a <cfquery> tag,
all it does is resolve
any CF expressions (there are none in your example), and then
passes the
finalised string to the DB and patiently waits for the DB to
respond, at
which point CF converts the DB-specific result set to a CF
recordset, and
returns it to the calling code. There is very little
involvement on the
part of CF other than that: the DB does most of the work, and
is providing
all the data.
All that said, it does seem weird that one DSN returns one
thing, and
another returns something else. Is your test rig like this:
<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">
<cfquery name="dte0" datasource="test456"
SELECT getdate() dte, DATEPART(dw, getdate()) dteDW,
$$DATEFIRST dteFirst,
@@language LanguageVersion
</cfquery>
<cfdump expand="Yes" label="Query Dump" var="#dte0">
IE: both queries to each DSN within the same CF template,
executed at the
same time.
(note: you have a syntax error in your <cfdump>
statement, so that actually
*isn't* the code you're running, because it would error).
If you run the query via some other client (like Query
Analyser, or SQL
Studio), what do you get? Does it differ from what CF
presents?
--
Adam