Home > database > ===========SQL Server partition table problem===================
===========SQL Server partition table problem===================
Time:11-18
Only take you 2 minutes time, thank you,,,,
Create table test ( Id int the not null, Create_datetime datetime not null, Create_year AS (datepart (year, create_datetime) PERSISTED, );
The create index ix_test____create_year on dbo. Test ( Create_year asc );
Insert into test values (' 2020-6-4 '), (' 2020-6-8 '), (' 2020-12-31 '), (' 2021-5-8 ');
- the above table among the create_datetime partition function on the application of the divisions, according to the - now to ask for all data in 2020, could you tell me the following query can make full use of the advantages of the partition table or said below I write is not correct, thank you,,, thank you,,,
- select * from test where year (create_datetime)=2020; - select * from test where create_year=2020;