Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Partition creation problem.

Status
Not open for further replies.

djj55

Programmer
Feb 6, 2006
1,761
US
Hello, SQL2008R2
I want to partition a table but am having problems with the partition creation
Code:
ALTER DATABASE Temp_DJJ ADD FILEGROUP MyTestFG;
GO
ALTER DATABASE Temp_DJJ ADD FILE (
    name = Test_ReadOnly1, 
    filename = 'C:\SQLData\MyTestFG.ndf', 
    size = 10mb, 
    maxsize = 200mb, 
    filegrowth = 5mb) TO FILEGROUP MyTestFG;
GO
-- Try for two partitions on prior to 6/1/12 and one after that.
CREATE PARTITION FUNCTION TestPF (DATETIME) AS RANGE LEFT FOR VALUES ('6/1/2012');
GO
CREATE PARTITION SCHEME TestIt AS PARTITION TestPF TO ([PRIMARY], MyTestFG);
GO
To which I get the error:
[tt]Msg 208, Level 16, State 58, Line 1
Invalid object name 'MyTestFG'.

[/tt]

Not to mention I am unclear how to associate the table say MyTable.

So where did I go wrong? Thanks

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
Posted in another forum and got the answer.

I needed to be in the database when creating the function/scheme.

djj
The Lord is my shepherd (Psalm 23) - I need someone to lead me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top