[dba-SQLServer] Delete all records of a particular type from a table except for one copy.

Susan Harkins ssharkins at setel.com
Sun Jul 8 18:07:27 CDT 2007


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.)




More information about the dba-SQLServer mailing list