You could use a trigger, but better just to use a stored proc. Something along the lines of..
Create procedure someproc @a int, @b varchar // etc etc as If exists(select a,b,c,d,e,f from sometable where [EMAIL PROTECTED] and ..........) begin // It does exist so do update end else begin // It doesn't exist so do insert end -----Original Message----- From: Howie Hamlin [mailto:[EMAIL PROTECTED] Sent: 17 March 2003 15:13 To: CF-Talk Subject: Newbe SQL question I have a basic MSSQL7 question - we have a table with no unique identifier (don't ask - I didn't design it) where, on an insert, we want to update a record if it exists and insert it if it doesn't. The record can be identified only by a combination of columns. For example - select a,b,c,d,e,f from sometable where ... In other words, selection based on 7 columns or so is the only way to uniquely identify a record. So, is it possible to have a trigger check for uniqueness and insert or update a record depending on whether the record was found? Thanks, -- Howie Hamlin - inFusion Project Manager On-Line Data Solutions, Inc. - www.CoolFusion.com - 631-737-4668 x101 inFusion Mail Server (iMS) - The Award-winning, Intelligent Mail Server >>> Find out how iMS Stacks up to the competition: >>> http://www.coolfusion.com/imssecomparison.cfm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4