Skip to content

Instantly share code, notes, and snippets.

View samirbehara-zz's full-sized avatar

Samir Behara samirbehara-zz

View GitHub Profile
<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>
select name, lock_escalation_desc
from sys.tables
ALTER TABLE tablename
SET (LOCK_ESCALATION = DISABLE) -- or TABLE or AUTO
--Returns detailed information about missing indexes
SELECT * FROM sys.dm_db_missing_index_details
--Returns information about what missing indexes are contained in a specific missing index group
SELECT * FROM sys.dm_db_missing_index_groups
--Returns summary information about groups of missing indexes
SELECT * FROM sys.dm_db_missing_index_group_stats
SELECT DISTINCT CONVERT(DECIMAL(18, 2) , user_seeks * avg_total_user_cost * ( avg_user_impact * 0.01 )) AS [index_advantage] ,
migs.last_user_seek ,
mid.[statement] AS [Database.Schema.Table] ,
mid.equality_columns ,
mid.inequality_columns ,
mid.included_columns ,
migs.unique_compiles ,
migs.user_seeks ,
migs.avg_total_user_cost ,
migs.avg_user_impact ,
SELECT name AS IndexName,
STATS_DATE(object_id, stats_id) AS LastStatisticsUpdate
FROM sys.stats
WHERE object_id = OBJECT_ID('TABLENAME')
and name ='INDEXNAME';
--ISJSON() - To verify that the text has valid JSON data
DECLARE @json nvarchar(max)
SET @json =N'
{
"Person": [
{
"FirstName": "Gustavo",
"LastName": "Achong",
"AccountNumber": "AW00029484",
"ModifiedDate": "2014-09-12T11:15:07.263"
--ISJSON() - To verify that the text has valid JSON data
DECLARE @json nvarchar(max)
SET @json =N'
{
"Person": [
{
"FirstName": "Gustavo",
"LastName": "Achong",
"AccountNumber": "AW00029484",
"ModifiedDate" "2014-09-12T11:15:07.263"
-- JSON_VALUE Demonstration to pull one scalar value from the JSON data
DECLARE @json nvarchar(max)
SET @json =N'
{
"Person": [
{
"FirstName": "Gustavo",
"LastName": "Harris",
"AccountNumber": "AW00029484",
"ModifiedDate": "2014-09-12T11:15:07.263"
-- JSON_QUERY Demonstration to extract an object or array from the JSON data
DECLARE @json nvarchar(max)
SET @json =N'
{
"Person": [
{
"Name": {
"FirstName": "Catherine",
"LastName": "Abel"
},