3 Replies Latest reply on Jan 20, 2008 7:11 PM by Dan Bracuk

    sql date time insert error

    craig_mac Level 1
      Hi i am having trouble entering a date in to a sql stored procedure.

      first i convert the date to the users current datetime using

      <cfscript>
      userTZ="#qGetClubDetails.LocalTime12#"; // or whatever tz ID you need
      tz=createObject("component","timeZone");
      userDateTime=tz.castFromServer(today,userTZ);
      </cfscript>

      then i need to insert this into a stored procedure using

      <cfstoredproc procedure="xsp_InsertSmsRecords" datasource="#application.ds#">
      <cfprocparam type="In" cfsqltype="CF_SQL_DATETIME" dbvarname="UsersDate" value="#CREATEODBCDATETIME(userDateTime)#" null="No">
      </cfstoredproc>

      but i am getting a error of
      Macromedia][SQLServer JDBC Driver][SQLServer]Error converting data type varchar to datetime.

      any ideas what i need to do?