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