a cleaner way of writing this might be:
<cfquery name="insert_hourly" datasource="storm">
INSERT INTO hourly
(employee_id
,ticket_no
,ticket_date
,labor_start
,labor_stop
,labor_lunch
,truck_id
,equip_start
,equip_stop
,equip_down
,equip_idle)
VALUES
(#employee_id#
,'#ticket_no#'
,'#ticket_date#'
,<cfqueryparam cfsqltype="cf_sql_timestamp" value ="#labor_start#"
null="#not(len(labor_start))#">
,<cfqueryparam cfsqltype="cf_sql_timestamp" value ="#labor_stop#'
null="#not(len(labor_stop))#">
ad infinitum :)
On 4/19/06, David Elliott <[EMAIL PROTECTED]> wrote:
>
> Below is a part of my code....
>
> <cfquery name="insert_hourly" datasource="storm">
> INSERT INTO hourly
> (employee_id
> ,ticket_no
> ,ticket_date
> <cfif labor_start IS NOT "">,labor_start</cfif>
> <cfif labor_stop IS NOT "">,labor_stop</cfif>
> <cfif labor_lunch IS NOT "">,labor_lunch</cfif>
> ,truck_id
> <cfif equip_start IS NOT "">,equip_start</cfif>
> <cfif equip_stop IS NOT "">,equip_stop</cfif>
> <cfif equip_down IS NOT "">,equip_down</cfif>
> <cfif equip_idle IS NOT "">,equip_idle</cfif>)
> VALUES
> (#employee_id#
> ,'#ticket_no#'
> ,'#ticket_date#'
> <cfif labor_start IS NOT "">,'#labor_start#'</cfif>
> <cfif labor_stop IS NOT "">,'#labor_stop#'</cfif>
> <cfif labor_lunch IS NOT "">,#labor_lunch#</cfif>
> ,#truck_id#
> <cfif equip_start IS NOT "">,'#equip_start#'</cfif>
> <cfif equip_stop IS NOT "">,'#equip_stop#'</cfif>
> <cfif equip_down IS NOT "">,#equip_down#</cfif>
> <cfif equip_idle IS NOT "">,#equip_idle#</cfif>)
> </cfquery>
>
> And my question might be a simple one....the line that says <cfif
> equip_idle IS NOT "">,equip_idle</cfif>...does this mean I'll only have any
> entry if their is a value in it? And isn't the code for the value portion
> of the statement also show up (as far as the field goes) if there is a
> value?
>
> Dave
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238185
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54