SQL to skip running Create Partition Function under SQL Server Express

Our database schema is stored in a single file that is intended for production use but we also use when running functional tests on our local boxes. We drop the database and rebuild it from this file and then add a known set of test data. All was working well.

Recently we added some performance improvements. The trouble came when we adding partitioning to one of the tables.

Msg 7736, Level 16, State 1
Partition function can only be created in Enterprise edition of SQL Server. Only Enterprise edition
of SQL Server supports partitioning.

Undaunted I added an if statement to check to see if we were running under Enterprise before enabling partitioning:

IF CHARINDEX('Enterprise', CONVERT(varchar(1000), SERVERPROPERTY('edition'))) > 0
    CREATE PARTITION FUNCTION [MyPartitionRange] (int)
    FOR VALUES (14200000, 14225000, 14250000, 14300000, 14350000, 14375000, 14400000, 14475000, 14500000, 14525000, 14550000, 14575000, 14600000, 14625000, 14650000, 14675000, 14700000, 14725000, 14750000, 14775000, 14800000, 14825000, 14850000, 14875000, 14900000, 14925000, 14950000, 14975000, 15000000 )

Unfortunately this still fails. I think SQL Server is telling us about the issue at the time it parses the CREATE PARTITION FUNCTION so it throws the error even if we don't use it.

Any suggestions?


You may consider this a hack, but you could put the 'create partition...' in a string and then call sp_executesql on it if you are on the right edition.

Need Your Help

what does the following code do?

ruby-on-rails ruby

i created a project demo in rails. i then created a scaffolded application by giving rail_apps/demo> script server products title :stiring,description :text,url: string

JQuery offset returns elements “old” position in IE7

jquery internet-explorer-7 css-position

Ok, got a weird bug going on here and so far google has failed to turn up anything addressing it.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.