# While Loop for deletes

**URL:** <https://forums.thehomestack.io/t/while-loop-for-deletes/367>\
**Category:** Databases\
**Created:** [March 1, 2010, 4:41am UTC](https://forums.thehomestack.io/t/while-loop-for-deletes/367 "2010-03-01T04:41:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://forums.thehomestack.io/uploads/default/original/1X/161426793bc0d8bdf0d1a6692b3e44446861cc72.jpeg) [@system](https://forums.thehomestack.io/u/system)\
**Post date:** [March 1, 2010, 4:41am UTC](https://forums.thehomestack.io/t/while-loop-for-deletes/367/1 "2010-03-01T04:41:31Z")

</div>

Here is a quick way to use the delete and loop throughout the records without increaing the transactions log to much:

```auto
WHILE @@ROWCOUNT > 0
	DELETE	TOP (1000)
	FROM orderAudit where userid='sql_query_chg_price'

```
