- Create table
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DECLARE @tosearch VARCHAR(MAX)='In' | |
SELECT (DATALENGTH(@string)-DATALENGTH(REPLACE(@string,@tosearch,'')))/DATALENGTH(@tosearch) | |
AS OccurrenceCount |
#Add a snippet below in settins.json | |
{ | |
"python.pythonPath": "Z:\\Projects\\Python\\ProjectName\\virtual_environment_name\\Scripts" | |
} | |
#It must have double backslashes, otherwise won't work. |
{ | |
// Use IntelliSense to learn about possible attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Python: Main File", | |
"type": "python", | |
"request": "launch", |
-- Create schema | |
CREATE SCHEMA Experiment; | |
-- Create first table | |
CREATE TABLE [Experiment].[DateRange1]( | |
[EmployeeID] [INT] NULL, | |
[Name] [VARCHAR](50) NULL, | |
[StartDate] [DATETIME] NULL, | |
[EndDate] [DATETIME] NULL | |
) ON [PRIMARY] |
SELECT | |
t.name AS TableName, | |
i.name as indexName, | |
sum(p.rows) as RowCounts, | |
sum(a.total_pages) as TotalPages, | |
sum(a.used_pages) as UsedPages, | |
sum(a.data_pages) as DataPages, | |
(sum(a.total_pages) * 8) / 1024 as TotalSpaceMB, | |
(sum(a.used_pages) * 8) / 1024 as UsedSpaceMB, | |
(sum(a.data_pages) * 8) / 1024 as DataSpaceMB |
DECLARE @T table (GroupSourceID varchar(100), EmployeeID VARCHAR(100), StartDate datetime, EndDate datetime); | |
insert into @T values | |
('Green', '1' , '2017-01-02 00:00' , '2017-03-28 00:10'), | |
('Green', '1' , '2017-05-14 23:50' , '2017-05-29 23:50'), | |
('Green', '1' , '2017-04-14 23:50' , '2018-05-29 23:50'), | |
('Yellow', '2' , '2017-05-18 00:00' , '2017-05-18 04:00'), | |
('Yellow', '2' , '2017-05-18 02:00' , '2017-05-18 03:00'), | |
('Yellow', '1' , '2017-05-18 02:00' , '2017-05-18 03:00'), | |
('Blue', '1', '2017-01-02 00:00' , '2017-01-17 15:50'), | |
('Blue', '1', '2017-01-12 00:00' , '2017-02-17 15:50'), |