notebook/IT/SQL/add_partition.sql
2020-11-26 18:38:25 +01:00

24 lines
612 B
Transact-SQL

-- ajouter partition
use [DB_GRAND_HOTEL]
ALTER DATABASE DB_GRAND_HOTEL ADD FILEGROUP FG_PART_2009;
ALTER DATABASE DB_GRAND_HOTEL
ADD FILE (NAME = 'F_PART_2009',
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL15.SQL2019FBIN2\MSSQL\DATA\FG_2009.ndf',
SIZE = 25 MB,
FILEGROWTH = 10 MB)
TO FILEGROUP FG_PART_2009;
GO
--2) modifier le schema de partitionnement
ALTER PARTITION SCHEME PS_DATE_FACTURE
NEXT USED FG_PART_2009;
GO
-- 3) ajouter le piquet de partitionnement
ALTER PARTITION FUNCTION PF_Date_facture()
SPLIT RANGE ('2019-01-01')
GO