Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7945797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:58:45+00:00 2026-06-04T00:58:45+00:00

I have created a partition function but I am not able to apply it

  • 0

I have created a partition function but I am not able to apply it to a table. I am not sure where I am going wrong.

Here is my partition function:

     CREATE PARTITION FUNCTION StaticDateMonthPartition (int)
     AS RANGE left
     FOR VALUES     (   
                    20120301,
                    20120401,
                    20120501,
                    20120601,
                    20120701,
                    20120801,
                    20120901,
                    20121001,
                    20121101,
                    20121201,
                    20130101,
                    20130201
                    )

trying to apply to this table:

    IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[partition_OLAP_Fact_vvv]') AND type in (N'U'))
    DROP TABLE [dbo].[partition_OLAP_Fact_vvv]
    GO

    CREATE TABLE [dbo].[partition_OLAP_Fact_vvv]
    (
        FFFFactvvvId            bigint,
        CORStaticDateId         int,
        CORVersionvvvId         bigint,
        vvvCount                tinyint,
        UPB                     decimal(18, 2)
    ) ON  CORStaticDateMonthPartition ([CORStaticDateId])

But when I try to execute the table script I get this error:

    Invalid partition scheme 'CORStaticDateMonthPartition' specified

Please Help.


Reposting my code with steps

Pinal’s tutoral is great! Here’s a quick summary

  1. Add file groups for each of your partitions

    Alter Database [database]   Add FileGroup partition_201207
    
  2. Create Partition Function

    CREATE PARTITION FUNCTION Partition_Range_CORStaticMonth(int)
    AS RANGE left
    FOR VALUES (20120301)
    
  3. Create Partition Scheme

    CREATE PARTITION SCHEME Partition_Scheme_CORStaticMonth
    AS PARTITION Partition_Range_CORStaticMonth
    TO (FFF_Fact_vvv_201203)
    
  4. Add Files to the File Groups

    ALTER DATABASE [database] 
    ADD FILE( 
            NAME = N'FFF_Fact_vvv_201203', 
            FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\FFF_Fact_vvv_201203.ndf' , 
            SIZE = 2048KB , 
            FILEGROWTH = 1024KB 
            ) 
    TO FILEGROUP [FFF_Fact_vvv_201203]
    
  5. Build Table with Partition Scheme applied

    IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[partition_Table]') AND type in (N'U'))
    DROP TABLE [dbo].[partition_Table]
    GO
    
    CREATE TABLE [dbo].[partition_Table]
    (
        CORStaticDateId         int
    ) ON  Partition_Scheme_CORStaticMonth ([CORStaticDateId])
    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:58:46+00:00Added an answer on June 4, 2026 at 12:58 am

    you need a partition scheme to apply to a table.

    The order is:

    1) Create your Filegroups

    2) Create your partition Function

    3) Attach Partition Scheme to FileGroups (using the partition Function)

    4) Create table on partition Scheme

    Check this link for a tutorial

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table 'X' and did the following CREATE PARTITION FUNCTION PF1(INT) AS
I'm not too sure how to explain this, but I will try. I have
I am trying to partition a DB table, I have created the filegroups correctly
I have a table created using the query CREATE TABLE branch_dim ( branch_id numeric(18,0)
I have a table defined as CREATE TABLE ItemDetail ( ItemNumber bigint not null,
I have the following table: CREATE TABLE [dbo].[PartsWork]( [parts_work_id] [int] IDENTITY(1,1) NOT NULL, [experiment_id]
i have sql table which has partitions. I recently created one partition. Even if
I have an MySQL table: CREATE TABLE responses ( id INT NOT NULL AUTO_INCREMENT,
Here is a function I would like to write but am unable to do
I've currently created a partition scheme / function in my database, and applied it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.