I am trying to populate the ID field of this table with the following. 
Please help


  <CFQUERY DATASOURCE="#application.dsn#" NAME="insert_cust_login">
   INSERT INTO cust_contacts
   VALUES  ( '#custNum#',
      '#f_name#',
      '#l_name#',
      '#email#',
      '#password#' )



DECLARE @maxid int
BEGIN
 SELECT @maxid = MAX(ID)
 FROM cust_contacts 
 WHERE custNum = '#custNum#'
IF @maxid IS NULL
 SELECT @maxid = 1
 ELSE
 SELECT @maxid = @maxid + 1
END

  </CFQUERY>



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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
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