🕵️♂️
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
IF OBJECT_ID('tempdb..#PrintMax') IS NOT NULL DROP PROC #PrintMax; | |
GO | |
/* | |
Author: Eitan Blumin (t: @EitanBlumin | b: eitanblumin.com) | |
Description: | |
This is a minified version of the PrintMax procedure (originally written by Ben Dill). | |
It's created as a temporary procedure. | |
*/ | |
CREATE PROCEDURE #PrintMax @str NVARCHAR(MAX) | |
AS |
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
/* | |
Author: Eitan Blumin (t: @EitanBlumin | b: eitanblumin.com) | |
Date: March, 2020 | |
Description: | |
Run DBCC CHECKDB on all databases which are either standalone, or SECONDARY in AG. | |
Supports non-readable secondaries by creating DB snapshots. | |
*/ | |
DECLARE @CurrDB SYSNAME, @IsInAG BIT, @CMD NVARCHAR(MAX); | |
-- Find all databases which are either standalone, or SECONDARY in AG |
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
/**************************************************************************************************/ | |
/* 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. |
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
/* | |
Author: Eitan Blumin | https://www.eitanblumin.com | |
Description: | |
Helper T-SQL script for adding SCHEMABINDING on scalar functions (checks in ALL databases on the server) | |
Added support for Azure SQL DB: Performs the same check across schemas instead of across databases | |
Instructions: | |
1. Run the script to detect all scalar functions with disabled SCHEMABINDING, that can potentially have it enabled. |
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
/* | |
----------------------------------- | |
TempDB Sizing Check and Remediation | |
----------------------------------- | |
Author: Eitan Blumin | https://www.eitanblumin.com | |
Description: | |
This script makes sure that all TempDB files are equally sized, based on a calculation that takes into consideration | |
the disk volume where the TempDB files are located. | |
This check only works when TempDB files are isolated from other databases and exist on their own dedicated volume. |
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
/* | |
---------------------------------------------------------------------------- | |
Shrink a Database File in Specified Increments | |
---------------------------------------------------------------------------- | |
Author: Eitan Blumin (t: @EitanBlumin | b: eitanblumin.com) | |
Creation Date: 2020-01-05 | |
Last Update: 2020-08-23 | |
---------------------------------------------------------------------------- | |
Description: | |
This script uses small intervals to shrink a file (in the current database) |
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
/* | |
Author: Eitan Blumin (t: @EitanBlumin | b: https://eitanblumin.com) | |
Date Created: 2013-09-01 | |
Last Update: 2020-07-28 | |
Description: | |
CTE-based Inline Table Function to generate periods for time series, based on an end date, period type, and number of periods back. | |
Supported period types: | |
MI - Minute | |
H - Hour |
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
-- Author: Eitan Blumin (t: @EitanBlumin | b: eitanblumin.com) | |
-- Date: 2020-05-31 | |
-- Last Update: 2021-04-22 | |
-- Description: Collect T-SQL Events using an Extended Events Buffer | |
SET NOCOUNT ON; | |
DECLARE | |
@SourceLinkedServer SYSNAME | |
, @MinimumDurationMilliSeconds BIGINT |
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
CREATE EVENT SESSION [TrackFailedLogins] ON SERVER | |
ADD EVENT sqlserver.error_reported( | |
ACTION(sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.nt_username,sqlserver.database_id,sqlserver.session_id) | |
WHERE (([severity]=(20) OR [severity]=(14) OR [severity]=(16)) | |
AND ([error_number]=(18056) | |
OR [error_number]=(17892) | |
OR [error_number]=(18061) | |
OR [error_number]=(18452) | |
OR [error_number]=(11248) | |
OR [error_number]=(17806) |
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
# Adventure Works SQL Database Project Build Configuration | |
trigger: | |
- master | |
pool: | |
vmImage: 'VS2017-Win2016' | |
variables: | |
solution: '**/*.sln' |
OlderNewer