發表文章

目前顯示的是 4月, 2019的文章

SQL Server Partition Table T-SQL 分割資料表實作步驟

圖片
1 新增空白資料庫 USE [master] GO CREATE DATABASE [PartitionTableLab] CONTAINMENT = NONE ON  PRIMARY ( NAME = N'PartitionTableLab', FILENAME = N'F:\SQL_DATA\PartitionTableLab.mdf'  , SIZE = 1024KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) LOG ON ( NAME = N'PartitionTableLab_log', FILENAME =  N'F:\SQL_DATA\PartitionTableLab_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB ,  FILEGROWTH = 1024KB ) GO 2 以年度建立 Partition Function 與 Partition Schema USE [master] GO ALTER DATABASE [PartitionTableLab] ADD FILEGROUP [FG_2012]; ALTER DATABASE [PartitionTableLab] ADD FILEGROUP [FG_2013]; ALTER DATABASE [PartitionTableLab] ADD FILEGROUP [FG_2014]; GO ALTER DATABASE [PartitionTableLab] ADD FILE ( NAME = N'HIS_2012', FILENAME =  N'F:\SQL_DATA\PartitionTableLab_his_2012.ndf' , SIZE = 1024KB , FILEGROWTH = 1024KB ) TO FILEGROUP [FG_2012] GO ALTER DATABASE [PartitionTableLab] ADD FILE ( NAME = N'HIS_2013&