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
SELECT COUNT(*) AS [TableCount] FROM [information_schema].[tables] WHERE [table_type] = 'BASE TABLE' |
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
SELECT CONCAT('ABC', REPLICATE('0',6-LEN(CAST(other_id as nvarchar(max)))), CAST(other_id as nvarchar(max))) | |
FROM [experiments].[dbo].[Table_1] | |
SELECT CONCAT('ABC', FORMAT(Other_Id, '000000')) | |
FROM [experiments].[dbo].[Table_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
SELECT | |
* | |
FROM | |
sys.foreign_keys fk | |
WHERE | |
EXISTS | |
( | |
SELECT | |
* | |
FROM |
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
SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint, | |
SCHEMA_NAME(schema_id) AS SchemaName, | |
OBJECT_NAME(parent_object_id) AS TableName, | |
type_desc AS ConstraintType | |
FROM sys.objects | |
WHERE type_desc IN ('FOREIGN_KEY_CONSTRAINT','PRIMARY_KEY_CONSTRAINT') |
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 strict'; | |
var gulp = require('gulp') | |
var path = require('path') | |
var uglify = require('gulp-uglify') | |
var vinylPaths = require('vinyl-paths'); | |
var del = require('del') | |
var browserify = require('browserify'); | |
var sourcemaps = require('gulp-sourcemaps'); |
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
var Bar = (function(parent) { | |
// constructor | |
var cls = function Bar(/* ... */) { | |
parent.call(this, /* ... */); | |
/* ... */ | |
}; | |
// inheritance | |
inherits(cls, parent); |
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
public static class TaskExtensions | |
{ | |
/// <summary> | |
/// Use to run async tasks in sync context. Configures await (by default set to false to not continue) and unwraps exception and result. | |
/// </summary> | |
public static TResult UnwrapResult<TResult>(this Task<TResult> task, bool continueOnCapturedContext = false) | |
{ | |
try | |
{ | |
task.ConfigureAwait(continueOnCapturedContext); |
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
using System.Xml; | |
using System.Xml.Linq; | |
namespace GithubWikiDoc | |
{ |
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
-- When renaming tables or moving schemas in Entity Framework, EF doesn't rename all related things (like FKs and PKs) | |
-- This might help to locate those database objects: | |
-- selects FKs and PKs with schema 'Core.' in their name | |
SELECT s.name, o.name FROM sys.objects AS o | |
INNER JOIN sys.schemas AS s ON s.schema_id = o.schema_id | |
WHERE o.name LIKE '%Slug%' OR o.name LIKE '%PageMetadata%' | |
-- performs renaming | |
sp_rename '[Inventory].[FK_Inventory.BaseProduct_Core.PageMetadata_PageMetadata_Id]', 'FK_Inventory.BaseProduct_Navigation.PageMetadata_PageMetadata_Id' |
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
set statistics time on | |
-- execute queries | |
set statistics time off | |
-- http://stackoverflow.com/a/11675263/108374 |