I have the following query and keep getting an error upon insert. The 
field type is varchar(10) and the one giving an error is custNum


Error = Error Diagnostic Information
      ODBC Error Code = 37000 (Syntax error or access violation) 


      [Microsoft][ODBC SQL Server Driver][SQL Server]Line 12: Incorrect 
syntax near '59595098'.
     





<CFQUERY DATASOURCE="#application.dsn#" NAME="insert_cust_loc_info">
   DECLARE @maxid int
   BEGIN
   SELECT  @maxid = MAX(ID)
   FROM   cust_location_info 
   IF    @maxid IS NULL
   SELECT   @maxid = 1
   ELSE
   SELECT   @maxid = @maxid + 1
   END

INSERT INTO   cust_location_info ( custNum,
                                                   id,
                                                   loc_desc,
                                                   f_name,
                                                   l_name,
                                                   address_1,
                                                   city,
                                                   state,
                                                   zip_code,
                                                   phone_1,
                                                   ext_1,
                                                   email,
                                                   isDefault )
 VALUES   '#Trim(custNum)#',
                         @maxid,
                         '#Trim(loc_desc)#',
                         '#Trim(f_name)#',
                         '#Trim(l_name)#',
                         '#Trim(address_1)#',
                         '#Trim(city)#',
                         '#Trim(state)#',
                         '#Trim(zip_code)#',
                         '#Trim(phone_1)#',
                         '#Trim(ext_1)#',
                         '#Trim(email)#',
                         'yes'
 WHERE    custNum = '#Trim(custNum)#'

</CFQUERY>


<CF_SIGNATURE
    NAME="Douglas L. Brown"
    EMAIL="[EMAIL PROTECTED]"
    PHONE="714.538.6611"
    WEB="http://www.carnivorepc.com";>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to