SlideShare a Scribd company logo
SQL Server 2016 –
Some New Features
@anniexu1990
Agenda
• IF EXISTS
• Text Split
• TemporalTables
• Columnstore indexes
IF EXISTS
--in versions before 2016
IF OBJECT_ID('[dbo].[V_319AdHocObjects]') IS NOT NULL
BEGIN
DROPVIEW [dbo].[V_319AdHocObjects];
END;
GO
CREATEVIEW [dbo].[V_319AdHocObjects]
AS
SELECT name AS object_name,
SCHEMA_NAME(schema_id) AS schema_name,
x.type_desc
FROM sys.objects x
LEFT JOIN sys.dm_exec_procedure_statsAS d ON
OBJECT_NAME(d.object_id, d.database_id) = name
WHERE SCHEMA_NAME(schema_id) <> 'sys';
--in versions 2016
DROPVIEW IF EXISTS [dbo].[V_319AdHocObjects];
GO
CREATEVIEW [dbo].[V_319AdHocObjects]
AS
SELECT name AS object_name,
SCHEMA_NAME(schema_id) AS schema_name,
x.type_desc
FROM sys.objects x
LEFT JOIN sys.dm_exec_procedure_statsAS d ON
OBJECT_NAME(d.object_id, d.database_id) = name
WHERE SCHEMA_NAME(schema_id) <> 'sys';
TEXT Split
SELECT [ID],
[REPORTING_SEGMENT]
FROM [Ad_Hoc].[dbo].[Service_Requests];
-- use 2016 new scirpt string_split to get number of IDs per reporting_Setment
SELECT value AS reporting_seg,
COUNT([ID])AS countofrequests
FROM [Ad_Hoc].[dbo].[Service_Requests]
CROSS APPLY string_split([REPORTING_SEGMENT], ',')
GROUP BY value;
TemporalTables
USE [Ad_Hoc]
GO
CREATETABLE [dbo].[DataAccuracy_GPM_Temporal](
[ID] int Identity(1,1) Primary Key,
[DataType] [varchar](20) NULL,
[System Name] [varchar](20) NULL,
[Date] [date] NULL,
[Model Field] [nvarchar](255) NULL,
[SourceValue] [money] NULL,
[GPTValue] [money] NULL,
[ModelValue] [decimal](14, 2) NULL
,SysStartTime datetime2GENERATEDALWAYS AS ROW
START HIDDEN NOT NULL
,SysEndTime datetime2GENERATEDALWAYS AS ROW
END HIDDEN NOT NULL
,PERIOD FOR SYSTEM_TIME (SysStartTime,SysEndTime))
WITH (SYSTEM_VERSIONING = ON
(HISTORY_TABLE=dbo.DataAccuracy_GPM_History));
Select [ID]
,[DataType]
,[System Name]
,[Date]
,[Model Field]
,[SourceValue]
,[GPTValue]
,[ModelValue]
,[SysStartTime]
,[SysEndTime]
--ChangeTimezone
--,convert(smalldatetime,[SysStartTime]ATTIME ZONE
'UTC'ATTIME ZONE 'Eastern StandardTime') as
'SystemStartTimeEST'
--,Case when [SysEndTime] = '9999-12-31
23:59:59.9999999' then [SysEndTime]ATTIME ZONE 'UTC'
--ELSE convert(smalldatetime, [SysEndTime]ATTIME
ZONE 'UTC'ATTIME ZONE 'Eastern StandardTime') end as
'SystemEndTimeEST'
from [dbo].[DataAccuracy_GPM_Temporal]
-- For SYSTEM_TIME FROM '2017-06-05 19:12:45.8094962'
to '2017-06-05 19:18:45.8094962'
-- For SYSTEM_TIME CONTAINED IN ( '2017-06-05
19:12:45.8094962', '2017-06-05 19:18:45.8094962')
Columnstore Indexes
--create normal rowstore index
CREATECLUSTERED INDEX [ClusteredIndex-RequestID]ON
[dbo].[Service_Requests_NormalIndex];
GO
--result normal index remember to show plan
SET STATISTICSTIME ON
SELECT [REQ_TYPE]
,count([ID])
FROM [Ad_Hoc].[dbo].[Service_Requests_NormalIndex]
group by [REQ_TYPE];
SET STATISTICSTIME OFF
go
-- create columnstore index
CREATECLUSTERED COLUMNSTORE INDEX [SR_ColumnStoreIndex]
ON Service_Requests_ColumnStoreIndex;
GO
--result
SET STATISTICSTIME ON
SELECT [REQ_TYPE]
,count([ID])
FROM [Ad_Hoc].[dbo].[Service_Requests_ColumnStoreIndex]
group by [REQ_TYPE];
SET STATISTICSTIME OFF
go

More Related Content

Similar to Sql server 2016 – some new features

DNN Database Tips & Tricks
DNN Database Tips & TricksDNN Database Tips & Tricks
DNN Database Tips & Tricks
Will Strohl
 
Database Systems - SQL - DDL Statements (Chapter 3/2)
Database Systems - SQL - DDL Statements (Chapter 3/2)Database Systems - SQL - DDL Statements (Chapter 3/2)
Database Systems - SQL - DDL Statements (Chapter 3/2)
Vidyasagar Mundroy
 
supporting t-sql scripts for Heap vs clustered table
supporting t-sql scripts for Heap vs clustered tablesupporting t-sql scripts for Heap vs clustered table
supporting t-sql scripts for Heap vs clustered table
Mahabubur Rahaman
 
Using web2py's DAL in other projects or frameworks
Using web2py's DAL in other projects or frameworksUsing web2py's DAL in other projects or frameworks
Using web2py's DAL in other projects or frameworks
Bruno Rocha
 
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdfI am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
irshadkumar3
 
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
sukrithlal008
 
Designer's Favorite New Features in SQLServer
Designer's Favorite New Features in SQLServerDesigner's Favorite New Features in SQLServer
Designer's Favorite New Features in SQLServer
Karen Lopez
 
Micro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateMicro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateKiev ALT.NET
 
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Julian Hyde
 
When to NoSQL and when to know SQL
When to NoSQL and when to know SQLWhen to NoSQL and when to know SQL
When to NoSQL and when to know SQL
Simon Elliston Ball
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know
Norberto Leite
 
Mongo+java (1)
Mongo+java (1)Mongo+java (1)
Mongo+java (1)
MongoDB
 
Neo4j: Import and Data Modelling
Neo4j: Import and Data ModellingNeo4j: Import and Data Modelling
Neo4j: Import and Data Modelling
Neo4j
 
Couchbas for dummies
Couchbas for dummiesCouchbas for dummies
Couchbas for dummies
Qureshi Tehmina
 
Jackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSVJackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSV
Tatu Saloranta
 

Similar to Sql server 2016 – some new features (20)

DNN Database Tips & Tricks
DNN Database Tips & TricksDNN Database Tips & Tricks
DNN Database Tips & Tricks
 
Database Systems - SQL - DDL Statements (Chapter 3/2)
Database Systems - SQL - DDL Statements (Chapter 3/2)Database Systems - SQL - DDL Statements (Chapter 3/2)
Database Systems - SQL - DDL Statements (Chapter 3/2)
 
supporting t-sql scripts for Heap vs clustered table
supporting t-sql scripts for Heap vs clustered tablesupporting t-sql scripts for Heap vs clustered table
supporting t-sql scripts for Heap vs clustered table
 
Using web2py's DAL in other projects or frameworks
Using web2py's DAL in other projects or frameworksUsing web2py's DAL in other projects or frameworks
Using web2py's DAL in other projects or frameworks
 
SAS Internal Training
SAS Internal TrainingSAS Internal Training
SAS Internal Training
 
Mysql rab2-student
Mysql rab2-studentMysql rab2-student
Mysql rab2-student
 
Mysql rab2-student
Mysql rab2-studentMysql rab2-student
Mysql rab2-student
 
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdfI am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
I am getting an errormsg 911, Level 16, State 1, Line 12 Database.pdf
 
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx171_74_216_Module_5-Non_relational_database_-mongodb.pptx
171_74_216_Module_5-Non_relational_database_-mongodb.pptx
 
Designer's Favorite New Features in SQLServer
Designer's Favorite New Features in SQLServerDesigner's Favorite New Features in SQLServer
Designer's Favorite New Features in SQLServer
 
Micro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicateMicro-ORM Introduction - Don't overcomplicate
Micro-ORM Introduction - Don't overcomplicate
 
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
Planning with Polyalgebra: Bringing Together Relational, Complex and Machine ...
 
Polyalgebra
PolyalgebraPolyalgebra
Polyalgebra
 
When to NoSQL and when to know SQL
When to NoSQL and when to know SQLWhen to NoSQL and when to know SQL
When to NoSQL and when to know SQL
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know
 
Mongo+java (1)
Mongo+java (1)Mongo+java (1)
Mongo+java (1)
 
Neo4j: Import and Data Modelling
Neo4j: Import and Data ModellingNeo4j: Import and Data Modelling
Neo4j: Import and Data Modelling
 
Couchbas for dummies
Couchbas for dummiesCouchbas for dummies
Couchbas for dummies
 
Jackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSVJackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSV
 
Msql
Msql Msql
Msql
 

Recently uploaded

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 

Recently uploaded (20)

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 

Sql server 2016 – some new features

  • 1. SQL Server 2016 – Some New Features @anniexu1990
  • 2. Agenda • IF EXISTS • Text Split • TemporalTables • Columnstore indexes
  • 3. IF EXISTS --in versions before 2016 IF OBJECT_ID('[dbo].[V_319AdHocObjects]') IS NOT NULL BEGIN DROPVIEW [dbo].[V_319AdHocObjects]; END; GO CREATEVIEW [dbo].[V_319AdHocObjects] AS SELECT name AS object_name, SCHEMA_NAME(schema_id) AS schema_name, x.type_desc FROM sys.objects x LEFT JOIN sys.dm_exec_procedure_statsAS d ON OBJECT_NAME(d.object_id, d.database_id) = name WHERE SCHEMA_NAME(schema_id) <> 'sys'; --in versions 2016 DROPVIEW IF EXISTS [dbo].[V_319AdHocObjects]; GO CREATEVIEW [dbo].[V_319AdHocObjects] AS SELECT name AS object_name, SCHEMA_NAME(schema_id) AS schema_name, x.type_desc FROM sys.objects x LEFT JOIN sys.dm_exec_procedure_statsAS d ON OBJECT_NAME(d.object_id, d.database_id) = name WHERE SCHEMA_NAME(schema_id) <> 'sys';
  • 4. TEXT Split SELECT [ID], [REPORTING_SEGMENT] FROM [Ad_Hoc].[dbo].[Service_Requests]; -- use 2016 new scirpt string_split to get number of IDs per reporting_Setment SELECT value AS reporting_seg, COUNT([ID])AS countofrequests FROM [Ad_Hoc].[dbo].[Service_Requests] CROSS APPLY string_split([REPORTING_SEGMENT], ',') GROUP BY value;
  • 5. TemporalTables USE [Ad_Hoc] GO CREATETABLE [dbo].[DataAccuracy_GPM_Temporal]( [ID] int Identity(1,1) Primary Key, [DataType] [varchar](20) NULL, [System Name] [varchar](20) NULL, [Date] [date] NULL, [Model Field] [nvarchar](255) NULL, [SourceValue] [money] NULL, [GPTValue] [money] NULL, [ModelValue] [decimal](14, 2) NULL ,SysStartTime datetime2GENERATEDALWAYS AS ROW START HIDDEN NOT NULL ,SysEndTime datetime2GENERATEDALWAYS AS ROW END HIDDEN NOT NULL ,PERIOD FOR SYSTEM_TIME (SysStartTime,SysEndTime)) WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE=dbo.DataAccuracy_GPM_History)); Select [ID] ,[DataType] ,[System Name] ,[Date] ,[Model Field] ,[SourceValue] ,[GPTValue] ,[ModelValue] ,[SysStartTime] ,[SysEndTime] --ChangeTimezone --,convert(smalldatetime,[SysStartTime]ATTIME ZONE 'UTC'ATTIME ZONE 'Eastern StandardTime') as 'SystemStartTimeEST' --,Case when [SysEndTime] = '9999-12-31 23:59:59.9999999' then [SysEndTime]ATTIME ZONE 'UTC' --ELSE convert(smalldatetime, [SysEndTime]ATTIME ZONE 'UTC'ATTIME ZONE 'Eastern StandardTime') end as 'SystemEndTimeEST' from [dbo].[DataAccuracy_GPM_Temporal] -- For SYSTEM_TIME FROM '2017-06-05 19:12:45.8094962' to '2017-06-05 19:18:45.8094962' -- For SYSTEM_TIME CONTAINED IN ( '2017-06-05 19:12:45.8094962', '2017-06-05 19:18:45.8094962')
  • 6. Columnstore Indexes --create normal rowstore index CREATECLUSTERED INDEX [ClusteredIndex-RequestID]ON [dbo].[Service_Requests_NormalIndex]; GO --result normal index remember to show plan SET STATISTICSTIME ON SELECT [REQ_TYPE] ,count([ID]) FROM [Ad_Hoc].[dbo].[Service_Requests_NormalIndex] group by [REQ_TYPE]; SET STATISTICSTIME OFF go -- create columnstore index CREATECLUSTERED COLUMNSTORE INDEX [SR_ColumnStoreIndex] ON Service_Requests_ColumnStoreIndex; GO --result SET STATISTICSTIME ON SELECT [REQ_TYPE] ,count([ID]) FROM [Ad_Hoc].[dbo].[Service_Requests_ColumnStoreIndex] group by [REQ_TYPE]; SET STATISTICSTIME OFF go