Monday, March 19, 2012

how to create a partitioned table?

Hi,

How to create a partitioned table(not view) in enterprise manager and T-SQL?

Thanks,

It sounds like you're talking about SQL2000. In SQL2000, the only way you can do it is to have multiple tables and a view which makes it look like a single one.

In SQL2005, sure... the standard example is:

CREATE PARTITION FUNCTION myRangePF1 (int)
AS RANGE LEFT FOR VALUES (1, 100, 1000) ;
GO
CREATE PARTITION SCHEME myRangePS1
AS PARTITION myRangePF1
TO (test1fg, test2fg, test3fg, test4fg) ;
GO
CREATE TABLE PartitionTable (col1 int, col2 char(10))
ON myRangePS1 (col1) ;
GO

Hope this helps...

Rob

No comments:

Post a Comment