Skip to content

Instantly share code, notes, and snippets.

🕵
Figuring it out

Eitan Blumin EitanBlumin

Block or report user

Report or block EitanBlumin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View trello_cards_to_github_issues.ps1
param (
[Parameter(Mandatory)][string] $GitHubToken,
[Parameter(Mandatory)][string] $GitHubOwner,
[Parameter(Mandatory)][string] $GitHubRepo,
[Parameter(Mandatory)][string] $SourceTrelloJsonFile,
[string[]] $TrelloLists,
[bool] $UpdateExistingIssuesByTitle = $true,
[bool] $AddNonExistingIssues = $true,
[bool] $Logging = $true
)
@EitanBlumin
EitanBlumin / PrintMax Minified Temporary Procedure.sql
Created May 2, 2019
This is a minified version of the PrintMax procedure (originally written by Ben Dill). It's created as a temporary procedure.
View PrintMax Minified Temporary Procedure.sql
IF OBJECT_ID('tempdb..#PrintMax') IS NOT NULL DROP PROC #PrintMax;
GO
CREATE PROCEDURE #PrintMax @str NVARCHAR(MAX)
AS
BEGIN
IF (@str IS NULL) RETURN;
DECLARE @LBindex INT,@len INT;
SET @len = 4000;
WHILE (LEN(@str) > @len) BEGIN
SET @LBindex = CHARINDEX((CHAR(10) + CHAR(13)) COLLATE database_default, REVERSE(LEFT(@str, @len)) COLLATE database_default);
View FilterParseJsonParameters.sql
/*
Fully Parameterized Search Query
--------------------------------
Copyright Eitan Blumin (c) 2018; email: eitan@madeiradata.com
You may use the contents of this SQL script or parts of it, modified or otherwise
for any purpose that you wish (including commercial).
Under the single condition that you include in the script
this comment block unchanged, and the URL to the original source, which is:
http://www.eitanblumin.com/
@EitanBlumin
EitanBlumin / Generate Procedure Unit Test with Auto-Comparison.sql
Last active Jan 16, 2019
Use this script to generate and run a "unit test" for two stored procedures. This script is good as a "sanity check" of sorts, that makes sure the operational effect of two procedures is the same. The script also prints out the duration of each procedure in milliseconds.
View Generate Procedure Unit Test with Auto-Comparison.sql
/**************************************************************************************************/
/* Generate Procedure Unit Test with Automatic Comparison */
/**************************************************************************************************/
-- Author: Eitan Blumin
-- Date: 2018-11-21
-- Description: Use this script to generate and run a "unit test" for two stored procedures.
-- Each procedure is considered to be affecting one or more database tables.
-- The contents of these tables can be compared before and after each unit test,
-- and the results of each of the two stored procedures can be compared.
@EitanBlumin
EitanBlumin / Get Recent SQL Error Log Errors.sql
Created Nov 22, 2018
Coalesces error messages from SQL Error Log into one row per exception
View Get Recent SQL Error Log Errors.sql
DECLARE @MinutesBackToCheck INT = 10;
SET NOCOUNT ON;
DECLARE @start DATETIME;
SET @start=DATEADD(MINUTE,-@MinutesBackToCheck,GETDATE());
DECLARE @errors AS TABLE
(
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED,
LogDate DATETIME,
@EitanBlumin
EitanBlumin / Find Orphaned Records By Foreign Key.sql
Last active Dec 17, 2018
Find which records are causing your Foreign Key check to fail
View Find Orphaned Records By Foreign Key.sql
/************** Find Orphaned Records **************
Author: Eitan Blumin
****************************************************/
DECLARE
@ForeignKeyName SYSNAME = 'FK_MyTable_MyOtherTable'
, @PrintOnly BIT = 0
DECLARE
@FKId INT,
@ChildTableID INT,
View Data Driven Alternative Email and File Share.sql
-- Based on script by Jason Selburg
-- https://www.sqlservercentral.com/Forums/Topic279460-150-1.aspx
-- http://www.sqlservercentral.com/scripts/Miscellaneous/31733/
USE ReportServer
GO
IF OBJECT_ID(N'[dbo].[data_driven_subscription]', 'P') IS NOT NULL
DROP PROCEDURE [dbo].[data_driven_subscription]
GO
@EitanBlumin
EitanBlumin / Review SQL Instance Best Practices.sql
Last active Feb 13, 2019
Condensed SQL Server Checkup of most common and impactful best practices
View Review SQL Instance Best Practices.sql
DECLARE
@NumOfMinutesBackToCheck INT = 360,
@MinutesBackToCheck INT = 360,
@DaysBackToCheck INT = 10,
@MinAdHocSizeInMB INT = 200,
@MinAdHocPercent INT = 25,
@FreespaceMinimumMB INT = 1024,
@FreespaceMinimumPercent INT = 10,
@UnsentLogThresholdKB INT = 2048,
@UnrestoredLogThresholdKB INT = 2048,
@EitanBlumin
EitanBlumin / Online Index Operations without Enterprise.sql
Last active Oct 8, 2018
Generate Script to allow performing ONLINE index operations and heavy changes on huge tables, without needing Enterprise edition of SQL Server
View Online Index Operations without Enterprise.sql
/***********************************************************************************
Copyright: Eitan Blumin (c) 2018
https://gist.github.com/EitanBlumin/79222fc2be5163cec828d0a69270a0ab
***********************************************************************************/
GO
IF OBJECT_ID('tempdb..#PrintMax', 'P') IS NOT NULL DROP PROCEDURE #PrintMax;
GO
-----------------------------------------------------------------------------------------------
@EitanBlumin
EitanBlumin / Generate Synonyms Creation Script.sql
Created Aug 21, 2018
Generate Synonyms Creation Script for creating a "shell" database
View Generate Synonyms Creation Script.sql
DECLARE
@LinkedServer NVARCHAR(300),
@DBInLinkedServer NVARCHAR(300)
SET @LinkedServer = '111.222.111.222'
SET @DBInLinkedServer = 'SomeOtherDatabase'
-- Generate create script for any non-system schemas:
SELECT CreateStatement = N'CREATE SCHEMA ' + QUOTENAME(name) + N';', DropStatement = N'DROP SCHEMA ' + QUOTENAME(name) + N';'
You can’t perform that action at this time.