Uploaded image for project: 'Railo'
  1. Railo
  2. RAILO-2723

sql server 2012 timestamp inconsistency

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate Issue
    • Affects Version/s: 4.0.4.001
    • Fix Version/s: None
    • Labels:

      Description

      While testing some code for a transition from ACF to Railo 4, I found that a timestamp comparison in SQL Server 2012 was not functioning correctly. I first created the datetime, then bulk inserted records with that timestamp and finally ran a select with that timestamp to test to confirm that the records were stored. I found a majority of the time the inserted timestamp differed from the timestamp I created by a few milliseconds. Here is some sample code that produced the result for me.

      <cfset local.timeStamp = now() />

      <cfquery datasource="#application.cfg.appDsn#">
      DELETE FROM testTable
      WHERE JobTimestamp = <cfqueryparam value="#local.timeStamp#" cfsqltype="cf_sql_timestamp" />
      </cfquery>

      <cfquery datasource="#application.cfg.appDsn#" result="local.result">
      INSERT INTO testTable (
      TmpId
      , JobTimestamp
      )
      VALUES (
      1
      , <cfqueryparam value="#local.timeStamp#" cfsqltype="cf_sql_timestamp" />)
      </cfquery>

      <cfquery name="local.qTest" datasource="#application.cfg.appDsn#" result="local.result2">
      SELECT count FROM testTable
      WHERE JobTimestamp = <cfqueryparam value="#local.timeStamp#" cfsqltype="cf_sql_timestamp" />
      </cfquery>

      <cfdump var="#local.result#">
      <cfdump var="#local.timeStamp#">
      <cfdump var="#local.qTest#">
      <cfdump var="#local.result2#">
      <cfabort>

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                micstriit Michael Offner
                Reporter:
                mpennypacker Mark Pennypacker
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: