Jim Lawrence
jlawrenc1 at shaw.ca
Sun Jul 8 20:14:47 CDT 2007
Hi Susan: It may sound funny but I do not care which record is the record left. I was hoping that another step of adding an 'autoNumber' field was not necessary but maybe it is... Jim -----Original Message----- From: dba-sqlserver-bounces at databaseadvisors.com [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Susan Harkins Sent: Sunday, July 08, 2007 4:07 PM To: dba-sqlserver at databaseadvisors.com Subject: Re: [dba-SQLServer] Delete all records of a particular type from atable except for one copy. How do you determine "which" record doesn't get deleted -- does it even matter? If not, I'd just temporarily change the MyCode value, run a delete, and then reset the temp Mycode value. Susan H. Required: A SQL statement that when run deletes all matching records with field MyCode equal to 'C' except for 1 record. (The number of records with field MyCode set to 'C' varies of course.) _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com