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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you limit the number of rows in a table?

Status
Not open for further replies.

k8277

Programmer
Jan 10, 2003
104
US
When creating a new table, can you specify a max number of rows allowed?
 
No. I suppose you could set up an instead of insert trigger which checks the number of rows and then rejects the insert if it is more than the number you want, but why exactly do you care how many rows the table has if the data is all valid data?

Questions about posting. See faq183-874
 
We have an application that writes to a database that potentially has the capability to fill up the disk space on the server if a problem occurs.
 
You could set the Max size the DB can grow to suppress filling the disc in case of an error, but that will also create issues when the DB reaches that max and no application or user can change the data.

Thanks

J. Kusch
 

If you create a table like this, it won't let you insert rows more than 99.

create table lrows(thevalue varchar(100), row_id int identity(1,1) check (row_id < 100 ))
 

That assumes there will be no deletion on the table in the table's life time.

 
You could create a second file group, put a file in it that can only grow so much, then put this table in that file. But again, if the file fills the insert query will fail.

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(My very old site)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top