Dave,

I am not sure I follow 100%, but yes, the CFIF statements will stop the
values from being added. However, the column will still be in the database
for that new record and will have whatever default value you have assigned
to that column (or NULL if no default value has been set and the column
allows NULL values).

.......................
Ben Nadel 
www.bennadel.com

-----Original Message-----
From: David Elliott [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 19, 2006 2:26 PM
To: CF-Talk
Subject: sql question.....

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:238180
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

Reply via email to