Delete a record and all the records that precede it

advertisements

I have a table that has a primary key based on GUIDs. I need to find a record in this table based on the primary key and then delete this record and all the record that appear before it. Is there a command to delete preceding records or can anyone give me some example SQL on how I could do this.

I am using SLQ server 2008


In your question you state "that appear before it." or "preceding records" This concept needs to be defined more explicitly. SQL is based on Set theory - and in a set there is no implicit order to the items in the set (rows in the table) You have to define what preceding means based on the value of some attribute of the row...