Another option would be, if you had an auto-generated numeric primary key, determine your range, call a random number generator, verify that the number is a valid primary key, then do a DELETE * WHERE pk != randomKey.

Just thinking out loud.....
  ----- Original Message -----
  From: Greg Morphis
  To: CF-Talk
  Sent: Monday, August 16, 2004 2:32 PM
  Subject: Re: SQL Question

  I think you'd probably have to have a temp table and save a record to it
  and then delete out the entire original table and then insert the
  single row back into the table from temp.

  On Mon, 16 Aug 2004 15:19:39 -0400, Qasim Rasheed
  <[EMAIL PROTECTED]> wrote:
  > Hello
  >
  > I want to delete all records from a table except one (a random one).
  > Is there a way to do it? I am using SQL Server
  >
  >
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to