質問

Need help - How to create partition in SQL server which will held 2011, 2012, 2013 data in separate file groups.

I'm struggling to understand between RANGE RIGHT or RANGE LEFT....

役に立ちましたか?

解決

Please specify version of you sql server, and read this: http://msdn.microsoft.com/en-us/library/ms187802.aspx

As for RANGE LEFT/RIGHT difference and decision to choose one for datetime column (I'm assuming datetime, but what exactly is the type in your case?), the command would look like this for int type:

CREATE PARTITION FUNCTION OrderDateRangePFN(int)
AS
RANGE [LEFT | RIGHT] FOR VALUES (100,200,300)

When you use RANGE LEFT, the first partition will contain values <=100. With RANGE RIGHT it'll be <100, and that's the difference really (please note that also NULLs will be handled differently).

In your example, if you wish to create partition function on datetime column, with RANGE LEFT your boundary values would have to be specified like this:

('20111231 23:59:59.997','20121231 23:59:59.997','20131231 23:59:59.997')

With RANGE RIGHT it'll be more elegant and plain:

('20111231','20121231','20131231')
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top