@@ -647,34 +647,19 @@ To create statistics on a column, provide a query that returns the column for wh
647
647
648
648
By default, if you don't specify otherwise, serverless SQL pool uses 100% of the data provided in the dataset when it creates statistics.
649
649
650
- For example, to create statistics with default options (FULLSCAN) for a year column of the dataset based on the population .csv file:
650
+ For example, to create statistics with default options (FULLSCAN) for a population column of the dataset based on the us_population .csv file:
651
651
652
652
``` sql
653
- /* make sure you have credentials for storage account access created
654
- IF EXISTS (SELECT * FROM sys.credentials WHERE name = 'https://azureopendatastorage.blob.core.windows.net/censusdatacontainer')
655
- DROP CREDENTIAL [https://azureopendatastorage.blob.core.windows.net/censusdatacontainer]
656
- GO
657
-
658
- CREATE CREDENTIAL [https://azureopendatastorage.blob.core.windows.net/censusdatacontainer]
659
- WITH IDENTITY='SHARED ACCESS SIGNATURE',
660
- SECRET = ''
661
- GO
662
- */
663
653
664
- EXEC sys .sp_create_openrowset_statistics N' SELECT year
654
+ EXEC sys .sp_create_openrowset_statistics N' SELECT
655
+ population
665
656
FROM OPENROWSET(
666
- BULK ' ' https://sqlondemandstorage.blob.core.windows.net/csv/population/population.csv' ' ,
667
- FORMAT = ' ' CSV' ' ,
668
- FIELDTERMINATOR =' ' ,' ' ,
669
- ROWTERMINATOR = ' ' \n ' '
670
- )
671
- WITH (
672
- [country_code] VARCHAR (5) COLLATE Latin1_General_BIN2,
673
- [country_name] VARCHAR (100) COLLATE Latin1_General_BIN2,
674
- [year] smallint,
675
- [population] bigint
676
- ) AS [r]
677
- '
657
+ BULK ' ' Https://azureopendatastorage.blob.core.windows.net/censusdatacontainer/raw_us_population_county/us_population.csv' ' ,
658
+ FORMAT = ' ' CSV' ' ,
659
+ PARSER_VERSION = ' ' 2.0' ' ,
660
+ HEADER_ROW = TRUE)
661
+ AS [r]'
662
+
678
663
```
679
664
680
665
#### Create single-column statistics by specifying the sample size
0 commit comments