I was curious as to whether the following code is the best way to handle
updating datetime fields (SQL 2000). I use the isdate() function to verify
that my variable is indeed a date, and then update the db field with the
CreateODBCDate() function......is there another way I should be doing this??
thanks in advance for any advice or confirmation.....
<cfquery name="myQuery" datasource="myDSN">
UPDATE myTable
SET myField = <cfqueryparam value="#left(someValue,250)#"
cfsqltype="CF_SQL_VARCHAR">
<cfif isdate(trim(attributes.publishdate))>
, publishdate = #CreateODBCDate(attributes.publishdate)#
</cfif>
<cfif isdate(trim(attributes.unpublishdate))>
, unpublishdate = #CreateODBCDate(attributes.unpublishdate)#
</cfif>
WHERE myPKid = <cfqueryparam value=#val(id)# cfsqltype="CF_SQL_INTEGER">
</cfquery>
charlie hanlon
food service enablers, inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230617
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54