27,579
社区成员
发帖
与我相关
我的任务
分享
沒有要求,
這里來個例子
use test
go
create partition function fn_Char(nvarchar(1))
AS
RANGE LEFT FOR VALUES ('A','B')
go
create Partition Scheme Sch_Char
as partition fn_Char to
([primary],[primary],[primary])
go
set ANSI_WARNINGS on;
set ANSI_PADDING on;
CREATE TABLE Test
(
ID int identity(1,1),
Name nvarchar(50) not null,
Col as left(Name,1) PERSISTED primary key
) on Sch_Char(Col)
insert Test(Name) select 'AB'
insert Test(Name) select 'BA'
SELECT *, $PARTITION.fn_Char(Col) as 存儲分區位置 FROM Test
drop table Test