Thank you both for the suggestions. I still can't resolve this...


Indeed, SELECT '#CreateUUID()#' causes sql to look for the uuid as a column. 
  I also can't get the syntax 'SELECT (select '#CreateUUID()#') as MyUUID' 
to work.

The challenge is to update multiple rows to the same table where all fields 
other than the uuid are the same.  The new uuid needs to be unique as it is 
the key.  Some kind of combination of createuuid and then select isn't 
working...

Has anybody seen this or dealt with it, perhaps through sql scripting?

Thank you.


(The incremented version id also needs to change, but this can be done by +1 
it seems, thank you)



>From: Daniel Lancelot <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: CF-Talk <[EMAIL PROTECTED]>
>Subject: RE: Problem with Insert Using Select
>Date: Fri, 09 Feb 2001 14:50:00 -0000
>
>that wont work - db would look for a field with the generated UUID as a
>name...
>
>you need to have a subselect:
>
>INSERT into tbl (MyUUID, name, VersionID)
>SELECT (select '#CreateUUID()#') as MyUUID, name, VersionID + 1
>FROM tbl
>WHERE MYUUID = '#form.MyUUID#'
>
>that should work...
>
>HTH
>
>Dan
>
>-----Original Message-----
>From: Bob Silverberg [mailto:[EMAIL PROTECTED]]
>Sent: 09 February 2001 05:49
>To: CF-Talk
>Subject: RE: Problem with Insert Using Select
>
>
>You answered your own question in your last paragraph - you _can_ put
>constants and expressions in your select statement.
>
>Try something like this:
>
>INSERT into tbl (MyUUID, name, VersionID)
>SELECT '#CreateUUID()#', name, VersionID + 1
>FROM tbl
>WHERE MYUUID = '#form.MyUUID#'
>
>Bob
>
>-----Original Message-----
>From: andrew kopelman [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, February 08, 2001 11:00 PM
>To: CF-Talk
>Subject: Problem with Insert Using Select
>
>
>I want to insert new records into a table which has MyUUID as its primary
>key as well as a column, VersionId, which needs to be updated.  Each new
>record should be identical to the old record, except for a new MyUUID and 
>an
>incremented VersionID.  For example, this old record:
>
>MyUUID:  BT784-PI89
>MyName: Smith
>VersionID: 1
>
>should have its corresponding new record:
>MyUUID:  A622T-U8FF
>MyName: Smith
>VersionID: 2
>
>I can't use the query syntax:
>INSERT into tbl (MyUUID, name, VersionID)
>SELECT MyUUID, name, VersionID
>FROM tbl
>WHERE MYUUID = '#form.MyUUID#'
>
>because that would be overwriting (making non-unique) the UUID, not to
>mention the version number.
>
>Is there a way to do the insert with the Select as well as a dynamically
>generated uuid?  In other words, to simultaneously use the select for given
>columns (MyName) and passed-in values for other columns(MyUUID, VersionID).
>
>I need this to work with CF4.5; any ideas?
>
>Thanks ahead of time,
>Andrew Kopelman
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to