View LINQImmediateExecution.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ImmediateExecution | |
{ | |
static void Main(string[] args) | |
{ | |
var Employees = new List<Employee> | |
{ | |
new Employee { ID=1 , Name="Samir", Salary=30000 }, | |
new Employee { ID=2 , Name="Robert", Salary=42000 }, | |
new Employee { ID=3 , Name="Peter", Salary=54000 } | |
}; |
View JSON Scripts - SQL Server 2016.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Return results as a JSON text by using AUTO mode | |
SELECT TOP 2 [AddressID] | |
,[AddressLine1] | |
,[AddressLine2] | |
,[City] | |
,[StateProvinceID] | |
,[PostalCode] | |
FROM [AdventureWorks2016CTP3].[Person].[Address] | |
FOR JSON AUTO |
View Temporal Tables - SQL Server 2016.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Creating Temporal table with automatically named History table | |
CREATE TABLE dbo.Employee | |
( | |
EmployeeID int NOT NULL IDENTITY(1,1) PRIMARY KEY CLUSTERED, | |
EmployeeName varchar(50) NOT NULL, | |
Age int NULL, | |
Email nvarchar(50), | |
ValidFrom datetime2 GENERATED ALWAYS AS ROW START NOT NULL, |
View JSON Functions in SQL Server 2016.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--ISJSON() - To verify that the text has valid JSON data | |
DECLARE @json nvarchar(max) | |
SET @json =N' | |
{ | |
"Person": [ | |
{ | |
"FirstName": "Gustavo", | |
"LastName": "Achong", | |
"AccountNumber": "AW00029484", |
View Live Query Statistics.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Script to demonstrate the Live Query Statistics Feature in SQL Server 2016 | |
SELECT * FROM Production.Product PR | |
INNER JOIN Production.Product_ondisk PO | |
ON PO.SellStartDate = PR.SellStartDate | |
--ON PO.ProductSubcategoryID = PR.ProductSubcategoryID | |
INNER JOIN Production.ProductModel PM | |
ON PM.ProductModelID = PR.ProductModelID | |
CROSS APPLY Production.ProductSubcategory PSC |
View Compare Execution Plans.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Drop Index if exists | |
DROP INDEX IF EXISTS [idx_Person_Email_Date] ON [Person].[Person] | |
-- Execute a query with a missing index | |
SELECT e.BusinessEntityID FROM HumanResources.Employee e | |
INNER JOIN Person.Person p | |
ON p.ModifiedDate = e.ModifiedDate | |
WHERE p.EmailPromotion = 1 |
View TSQL Enhancements.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use TestDB | |
-- Before SQL Server 2016 | |
IF EXISTS(SELECT * FROM dbo.Employee) | |
DROP TABLE dbo.Employee | |
IF EXISTS(SELECT * FROM SYS.TABLES WHERE NAME ='dbo.Employee') | |
DROP TABLE dbo.Employee | |
-------------------------------------------------------------------------------------------------- |
View SQl Code Snippets.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Use Code Snippets to generate the syntax of your Non Clustered Index | |
CREATE UNIQUE NONCLUSTERED INDEX IX_TableName_Col1 | |
ON dbo.TableName | |
(column_1) | |
View Dynamic Toggle Functionality - TypeScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script> | |
<select id="switch" data-bind="value: selectedOption"> | |
<option value="option">Select Option...</option> | |
<option value="invNumber">Invoice Number </option> | |
<option value="subCode">Subscriber Code </option> | |
</select> | |
<br><br> |
View Dynamic Toggle Functionality - Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
<select id="switch"> | |
<option value="unknown">Select Option...</option> | |
<option value="invNumber">Invoice Number </option> | |
<option value="subCode">Subscriber Code </option> | |
</select> | |
<br><br> | |
<span id="invNumber-input" style="display:none"><input type="text" id="name"></span> |
OlderNewer