Note that this issues that trackusers.UserId is Auto Increment field.
  -----Original Message-----
  From: Steve Kahn [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, September 21, 2004 10:33 AM
  To: CF-Talk
  Subject: Re: Creating a unique ID from a Query Insert for use in an Update

  Yes Microsoft SQL:
  Is this correct usage?
  <cfquery>
        set nocount on
        Insert into trackusers(username,pwd)
        values(#username#,#pwd#);
        Select scope_identity() as myID
        Set nocount on
  </cfquery>
  Then:
      <cfset key = qryName.myID />

  Would the Update be ...

  <cfquery >
    UPDATE trackusers
    SET Logindate=#login_datetime#, IP='#remote_addr#',
browser='#http_user_agent#', remote_host='#remote_host#',
remote_referer='#http_referer#'
    WHERE userID = #key#
  </cfquery>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to