> Does anyone have any tips to keep SQL from writing form
> data that's not filled in as NULL instead of a space?
> I've never given this much consideration, because Oracle
> which I started Cfing with puts NULL in a field if you
> do: VALUES('','','') but now I find SQL Server puts a
> space (or something other than null) according to
> Enterprise Manager.
>
> I've always done this:
> INSERT INTO tblMember(name,address)
> VALUES('#trim(attributes.name)#','#trim(attributes.address)#')
> But the value it puts for name or address aren't null in
> Ent. Manager if no value is put in the form field. Does a
> space take more disk space than a NULL?
I don't think the issue here a matter of space, but rather the fact that you
typically want to use NULLs to represent unknown values.
You can easily do this with the CFQUERYPARAM tag, something like this:
VALUES(<cfqueryparam value="#Trim(Attributes.name)#"
cfsqltype="CF_SQL_VARCHAR"
null="#YesNoFormat(Len(Trim(Attributes.name))#">
, ... other values ...)
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4