Quantcast
Viewing all articles
Browse latest Browse all 15889

Partition table with non-clustered index

Hi,

I am in sqlserver 2005 developer edition. I have a table awrard_transaction which has refno column as primary key and has a primary key (unique clustered index on it), index name is pk_award_transaction.

I have another column "transaction_Datetime" based on which I want to partition my this table. transaction_Datetime column is part of 4 non unique non clustered indexes (idx1, idx2, idx3, idx4). I have created partition scheme and partition function as follows


CREATE PARTITION FUNCTION  PF_AWARD_TRANSACTION(DATETIME)
AS RANGE RIGHT FOR VALUES ();

CREATE PARTITION SCHEME PS_AWARD_TRANSACTION AS 
PARTITION PF_AWARD_TRANSACTION ALL TO ('PRIMARY');


--create a boundary for each month
DECLARE @Date datetime ;
DECLARE @EndDate datetime;
set @Date='20090101';
set @EndDate ='20181201';

WHILE @Date <= @EndDate
BEGIN
ALTER PARTITION SCHEME PS
NEXT USED 'PRIMARY';
ALTER PARTITION FUNCTION PF()
SPLIT RANGE (@Date);
SET @Date = DATEADD(month, 1, @Date);
END;

Can anyone help me to write a command to partition my this table based on transaction_datetime? Remember that my this partition key column is not part of clustered index and I can't make this part of clustered index.

Thanks in advance


Salman










Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>