Monday, March 19, 2012

[Sql2000] how to limit table size

hi all,
I checked out in google groups but was not able to find
the answer...
is it possible to limit size table in sql server?
how can I do it?

TIAilkaos wrote:

Quote:

Originally Posted by

hi all,
I checked out in google groups but was not able to find
the answer...
is it possible to limit size table in sql server?
how can I do it?
>
TIA


Add the table to some filegroup and then fix the total size of files in
that filegroup:

CREATE TABLE tbl
(... ) ON filegroup_xyz;

Take a look at ALTER DATABASE ... ADD FILEGROUP / FILE for more
details.

Alternatively, you could use constraints to limit the maximum number of
*rows* in a table (not necessarily comparable with the size of the
table in storage). The details of how to do this would depend on the
nature of the table and keys. For example:

/* Maximum 10,000 rows */
ALTER TABLE tbl ADD foo INT NOT NULL
CONSTRAINT ak_tbl_foo UNIQUE,
CONSTRAINT ck_tbl_foo CHECK (foo BETWEEN 1 AND 10000);

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/...US,SQL.90).aspx
--|||

Quote:

Originally Posted by

>"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org>


thanks a lot for you (very quick!) answer.

No comments:

Post a Comment