Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: 1437 | 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
FORUM

sql time intervals problem

sql time intervals problem

Tags
 
Contribute