Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Table Partitioning

Author  Topic 

only4u.nikhil
Starting Member

3 Posts

Posted - 2008-11-05 : 09:08:05
I want to partition one table for archiving the records. In the current scenario there is “status” filed in the table which has two integer values say 1 and 2 ( 2 means Records to archive). I want to create two partitions such a way that primary partition will have all the records having “status” equal to 1 and secondary partition will have all the records having “status” equal to 2. How can I create partition function so that, records with status equal to 2 will be moved to secondary partition. Sample script is as bellow.
USE TestDB;
GO
--- Step 2 : Create Partition Range Function
CREATE PARTITION FUNCTION TestDB_PartitionRange (INT)
AS RANGE LEFT FOR
VALUES (2);
GO

But using this script, the records which have status greater than 2 are moving to the secondary partition. Kindly write me solution so that I can move records with status exactly equal to 2 to secondary partition. Thanks in advance

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-11-05 : 09:17:05
quote:
Originally posted by only4u.nikhil

I want to partition one table for archiving the records. In the current scenario there is “status” filed in the table which has two integer values say 1 and 2 ( 2 means Records to archive). I want to create two partitions such a way that primary partition will have all the records having “status” equal to 1 and secondary partition will have all the records having “status” equal to 2. How can I create partition function so that, records with status equal to 2 will be moved to secondary partition. Sample script is as bellow.
USE TestDB;
GO
--- Step 2 : Create Partition Range Function
CREATE PARTITION FUNCTION TestDB_PartitionRange (INT)
AS RANGE Right FOR
VALUES (2);
GO


But using this script, the records which have status greater than 2 are moving to the secondary partition. Kindly write me solution so that I can move records with status exactly equal to 2 to secondary partition. Thanks in advance


Go to Top of Page
   

- Advertisement -