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 2008 Forums
 Transact-SQL (2008)
 Generate 'Table Partition Function'

Author  Topic 

nicklarge
Starting Member

40 Posts

Posted - 2012-03-01 : 12:22:13
Hello.

I have created a deployment script for a DW, using the cool generate scripts functionality in SQL 2008. In this script is a table that is partitioned. When I run the deployment script on our test machine I get the following error:

Msg 1921, Level 16, State 1, Line 1
Invalid partition scheme 'ETLMetadata_SalesTransaction_PartitionScheme_Modulo' specified.

How do I get the CREATE script for the scheme as I know it exists in our development site that I am generating the scripts from.

Thanks in advance, Nick.


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ETLMetadata_SalesTransaction](
[ETL Metadata Key] [int] IDENTITY(1,1) NOT NULL,
[Process Audit File ID] [int] NULL,
[File Sequence Number] [int] NULL,
[Created Timestamp] [datetime] NULL,
[Datamart Loaded Timestamp] [datetime] NULL,
[Partition Modulo Value] [smallint] NULL,
CONSTRAINT [PK_ETLMetadata_SalesTransaction_full] PRIMARY KEY NONCLUSTERED
(
[ETL Metadata Key] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, DATA_COMPRESSION = PAGE) ON [PRIMARY]
) ON [ETLMetadata_SalesTransaction_PartitionScheme_Modulo]([Partition Modulo Value])
WITH
(
DATA_COMPRESSION = PAGE
)
GO
CREATE NONCLUSTERED INDEX [IDX_ETLMetadata_SalesTransaction_DatamartLoadedTimestamp] ON [dbo].[ETLMetadata_SalesTransaction]
(
[Datamart Loaded Timestamp] ASC,
[Created Timestamp] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IDX_ETLMetadata_SalesTransaction_PFID] ON [dbo].[ETLMetadata_SalesTransaction]
(
[Process Audit File ID] ASC
)
INCLUDE ( [File Sequence Number],
[Datamart Loaded Timestamp]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO

nicklarge
Starting Member

40 Posts

Posted - 2012-03-01 : 13:00:34
I finally worked the answer out.

What I did was to :

1) seperately do a 'Generate Scripts' on the tables that missed the Partition Function Scripts
2) before I click finish, select the generate the scripts to new tab and click on the 'Advanced' button, then select 'script dependant objects'.

Thanks MS, well hidden!

Nick.
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2012-03-01 : 13:30:35
Excellent, thanks for showing us how you solved it!

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -