Hi! I have a form that users fill out and the data is stored in the database (SQL server). All fields are not required. When I use <cfquery> with the SQL insert into tablename(field1,field2, etc.) values (...), the record is stored with blank fields when the user entered nothing instead of explicit nulls (which I want).
When I use <cfinsert tablename="tname" datafields="field1,field2", the explicit nulls are stored for any field on the form for which the user entered nothing. However, if the user enters an explicit blank in the field, it is stored as a blank and not a null.
I have all form fields defined in the action template using <cfparam>. I want explicit null values for fields not entered. Do I need to Ltrim every form field before using cfinsert? What's the difference here?
Thanks and I hope this makes sense.
When I use <cfinsert tablename="tname" datafields="field1,field2", the explicit nulls are stored for any field on the form for which the user entered nothing. However, if the user enters an explicit blank in the field, it is stored as a blank and not a null.
I have all form fields defined in the action template using <cfparam>. I want explicit null values for fields not entered. Do I need to Ltrim every form field before using cfinsert? What's the difference here?
Thanks and I hope this makes sense.