Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Row Wrap

Status
Not open for further replies.
You cannot do this.

If you want to prevent your table from getting too large, you would need to delete rows yourself.


-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Options you might consider....

Put the rows being inserted into a temp table. Count the rows in the temp table. Delete that number of rows from the real table. Insert the rows from the temp table into the real table.

Insert the rows into the real table, count the number of rows, subtract the number you want to keep, and delete enough to get to the number you want to keep.

You might be able to create an INSERT Trigger that deletes a row for every row inserted...but I've never tried that.

You would need to have some way to identify which rows needed to be deleted. Having an IDENTITY(1,1) column would help.

So as George stated...SQL Server isn't designed to do what you want...but there are ways you can script it to happen.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top