So I have to put a cfif at each value to check for length greater than zero and if it is not, set the value to " " for each field...for each iteration?
-----Original Message----- From: Rob Parkhill [mailto:robert.parkh...@gmail.com] Sent: Tuesday, June 16, 2009 1:42 PM To: cf-talk Subject: Re: insert trouble...zero length You will have to make sure that the table you are inserting into can have a NULL as a value, or you will need to modify your code to look at each value and change any NULLs to either a space or a zero depending on the datatype you are inserting. HTH Rob On Tue, Jun 16, 2009 at 1:33 PM, Mark Fuqua MdProfinish < m...@mdprofinish.com> wrote: > > Having trouble with the following code.having trouble with "zero length" > values. The field in the database is empty and when it goes to insert it > into another table, it chokes. Is there a way to set a " " value as > default? Or do I have to do a cfif on each value? I'm sure I'm missing > something simple here. > > > > > > <cfquery name="transferData" datasource="brooklineOld"> > > SELECT * > > FROM plumUser > > Where ContactType = 3 and userId = 34 > > </cfquery> > > > > > > <cfloop query="transferData"> > > <cfquery name="insertNew" datasource="brookline"> > > INSERT INTO PlumUser(address1, CellPhone, CellPhoneCarrier, > CellPhoneEmail, > City, > > CompanyName, ContactType, Country, DateCreated, Email, Extension, Fax, > FirstName, HomePhone, > > LastName, OfficePhone, Password, State, Status, SubShortName, UserName, > ZipCode) > > VALUES( '#transferData.Address1#', '#transferData.CellPhone#', > > '#transferData.CellPhoneCarrier#', '#transferData.CellPhoneEmail#', > '#transferData.City#', > > '#transferData.CompanyName#',#transferData.ContactType#, > '#transferData.Country#', > > #CreateODBCDate(transferData.DateCreated)#, '#transferData.Email#', > '#transferData.Extension#', > > '#transferData.Fax#', '#transferData.FirstName#', > '#transferData.HomePhone#', '#transferData.LastName#', > > '#transferData.OfficePhone#', '#transferData.Password#', > '#transferData.State#',#transferData.Status#, > '#transferData.SubShortName#', '#transferData.UserName#', > > '#transferData.ZipCode#' ) > > </cfquery> > > </cfloop> > > > > Thanks, > > > > Mark > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323535 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4