1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| DROP TABLE IF EXISTS [dbo].[Test]
CREATE TABLE [dbo].[Test]( [ID] [int] NOT NULL IDENTITY(1,1), [CustomerID] [VARCHAR](40) NOT NULL, [col1] [VARCHAR](100) SPARSE NULL, [col2] [VARCHAR](100) SPARSE NULL, [col3] [VARCHAR](100) SPARSE NULL, [col4] [VARCHAR](100) SPARSE NULL, [CreateDate] [datetime2](3) NOT NULL, ) ON [PRIMARY]
CREATE UNIQUE CLUSTERED INDEX CIX_ID ON [dbo].[Test](ID)
INSERT INTO [dbo].[Test] ([CustomerID],Col1,Col2,Col3,Col4,[CreateDate]) SELECT TOP 10000000 REPLICATE('ABCD',10), REPLICATE('A',100), REPLICATE('B',100), REPLICATE('C',100), REPLICATE('D',100), SYSDATETIME() FROM sys.all_columns c1 CROSS JOIN sys.all_columns c2
DROP TABLE IF EXISTS [dbo].[TestSplit]
CREATE TABLE [dbo].[TestSplit]( [ID] [int] NOT NULL IDENTITY(1,1), [CustomerID] [VARCHAR](40) NOT NULL, [col1] [VARCHAR](2000) SPARSE NULL, [col2] [VARCHAR](2000) SPARSE NULL, [col3] [VARCHAR](2000) SPARSE NULL, [col4] [VARCHAR](2000) SPARSE NULL, [CreateDate] [datetime2](3) NOT NULL, ) ON [PRIMARY]
CREATE UNIQUE CLUSTERED INDEX CIX_ID ON [dbo].[TestSplit](ID)
INSERT INTO dbo.[TestSplit] ([CustomerID],Col1,Col2,Col3,Col4,[CreateDate]) SELECT TOP 1000000 REPLICATE('ABCD',10), REPLICATE('A',2000), REPLICATE('B',2000), REPLICATE('C',2000), REPLICATE('D',2000), SYSDATETIME() FROM sys.all_columns c1 CROSS JOIN sys.all_columns c2
|