when i try to create partition on the temp table im getting the below error:Msg 1921, Level 16, State 1, Line 32Invalid partition scheme 'PartitionToPrimary' specified.code tried: IF OBJECT_ID('tempdb..#hubbabubba') IS NOT NULLBEGIN DROP TABLE #hubbabubba;END CREATE TABLE #hubbabubba ( someint INT PRIMARY KEY NONCLUSTERED IDENTITY(1,1) ,somechar VARCHAR(50) ,somedate DATE ,somebit BIT DEFAULT(0)) IF EXISTS (SELECT name FROM sys.partition_schemes WHERE name = 'PartitionToPrimary') BEGIN DROP PARTITION SCHEME PartitionToPrimary ENDIF EXISTS (SELECT name FROM sys.partition_functions WHERE name = 'PartitionByMonth') BEGIN DROP PARTITION FUNCTION PartitionByMonth END CREATE PARTITION FUNCTION PartitionByMonth (DATE) AS RANGE RIGHT FOR VALUES ('2014/01/01', '2014/02/01', '2014/03/01', '2014/04/01', '2014/05/01','2014/06/01' , '2014/07/01', '2014/08/01', '2014/09/01', '2014/10/01', '2014/11/01', '2014/12/01'); CREATE PARTITION SCHEME PartitionToPrimary AS PARTITION PartitionByMonth ALL TO ([PRIMARY]); CREATE CLUSTERED INDEX idx_hubba_somedate ON #hubbabubba (somedate) ON PartitionToPrimary (somedate);GO
Can any one help me on this?