but if the value is not exists in "COLUM" I'll need to use INSERT to assign
default values.
I can't predicte all the possible values, so I can't make a
"READY-FOR-UPDATE-ONLY" table.


----- Original Message -----
From: "Phil Ewington" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Sunday, April 22, 2001 1:18 PM
Subject: RE: UPDATE / INSERT


> Micheal,
>
> Thinking about it, if the value does exist and you simply want to check
what
> that value is before updating, you could always do an update irrespective
of
> the value, sure, this will mean doing an un-necessary update sometimes,
but
> isn't that better than making two connections (select & update) if the
> update is required. Only a thought.
>
>
> Phil.
>
> > -----Original Message-----
> > From: Phil Ewington [mailto:[EMAIL PROTECTED]]
> > Sent: 22 April 2001 12:04
> > To: CF-Talk
> > Subject: RE: UPDATE / INSERT
> >
> >
> > Do you mean if the record exists UPDATE, or if the value in the column
is
> > specified update?
> >
> > If the record does not exist, use cftry/cfcatch: try UPDATE, if fails do
> > INSERT.
> >
> > If the record exists but value is NULL, you are probably better
> > off setting
> > the columns default value to zero, this way you will always be able to
> > increment the value by 1 using UPDATE.
> >
> > HTH
> >
> > Phil.
> >
> > > -----Original Message-----
> > > From: Michael Lugassy [mailto:[EMAIL PROTECTED]]
> > > Sent: 22 April 2001 13:06
> > > To: CF-Talk
> > > Subject: UPDATE / INSERT
> > >
> > >
> > > I'm trying to find the best way to have SQL do this:
> > > IF COLUM1 already contains "VALUE" then UPDATE COLUM2+1
> > > IF NOT, INSERT COLUM1,COLUM2 VALUES ("VALUE",1)
> > >
> > > Currently I'm using SELECT / RecordCount to first find out if the
> > > VALUE exists.
> > >
> > > There must be a better way...
> > >
> > > Michael.
> > >
> > >
> > >
> > >
> > >
> > >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to