Trying to make a smaller sample database but still have the data be somewhat statistically relevant. How can I delete x % of rows from the table ? Been fooling around with the NEWID() function.
DELETE
FROM TABLE_NAME
WHERE PK IN (SELECT TOP (75) PRECENT PK
FROM TABLE_NAME
ORDER BY NEWID())
Suggestion by Martin Smith
DELETE T
FROM (SELECT TOP (75) PERCENT *
FROM TABLE_NAME
ORDER BY NEWID()) T
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With