> I would like to insert a NULL value into a SQL 7 table if a field
> is not filled in.
>
> How do I go about doing this? Is this a wise thing to do? Why
> doesn't SQL 7 automatically do that?
Erm, it does!
It depends on how you're inserting the records
If you're using CFQUERY;
insert into myTable (field1, field2, field3)
values ('#field1#', '#field2#', '#field3#')
Then it'll be inserting an empty string - you have to do it like this;
insert into myTable (field1, field2, field3)
values (
<cfif field1 is "">
NULL
<cfelse>
'#field1#'
</cfif>
,
<cfif field2 is "">
NULL
<cfelse>
'#field2#'
</cfif>
,
<cfif field3 is "">
NULL
<cfelse>
'#field3#'
</cfif>
)
Or similar...
Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133
"Websites for the real world"
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists