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 } | |
}; |
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 |
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, |
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 the table and user(if they exist) | |
DROP TABLE IF EXISTS dbo.Customer | |
DROP USER IF EXISTS TestUser | |
-------------------------------------------------------------------------------------------------- | |
-- Create table with different masking functions | |
CREATE TABLE dbo.Customer | |
( | |
CustomerID INT IDENTITY PRIMARY KEY, |
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", |
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 |
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 |
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 | |
-------------------------------------------------------------------------------------------------- |
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) | |
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