Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

usp_PartitionDatabase

By Pedro Lopes MS,

EXEC usp_PartitionDatabase '<dbname>', '<right_or_left>', '<date_or_numeric>', '<interval>', '<set_max_value>'

For <interval> the options are:
If datetime key, interval may be: month, quarter, semester, year, between single quotes
If datetime key, set_max_value is a maximum date in dd-mm-yyyy format between single quotes
If numeric key, interval may be: hundreds, thousands, t_thousands (tens of thousand), h_thousands (hundreds of thousand), millions, between single quotes
If numeric key, set_max_value is a maximum number, between single quotes

Example with numeric key:
EXEC usp_PartitionDatabase 'database', 'left', 'numeric', 'h_thousands', '10000000'

Example with datetime key:
EXEC usp_PartitionDatabase 'database', 'right', 'date', 'quarter', '01-01-2011'

Total article views: 1411 | Views in the last 30 days: 2
 
Related Articles
FORUM

Diff between Numeric & Float

Diff between Numeric & Float

FORUM

Difference between Numeric and Float

Difference between Numeric and Float

FORUM

Difference between Composite Index and Single Column Indexes ?

Difference between Composite Index and Single Column Indexes ?

FORUM

sql time intervals problem

sql time intervals problem

FORUM
Tags
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones