Skip to content

Instantly share code, notes, and snippets.

View matthew-n's full-sized avatar

Matt N. matthew-n

  • Houston, Tx
View GitHub Profile
@matthew-n
matthew-n / ErrorHandler.sql
Last active March 21, 2024 01:28
SQL Server: TSQL Callstack Emulation
IF OBJECT_ID('dbo.ErrorHandler') IS NULL BEGIN
EXEC ('CREATE PROCEDURE dbo.ErrorHandler AS BEGIN SELECT 1; END;');
END
GO
--our error handling procedure
ALTER PROCEDURE dbo.ErrorHandler @procName NVARCHAR(128), @ErrorMessage NVARCHAR(4000) OUTPUT, @ErrorSeverity INT OUTPUT, @ErrorState INT OUTPUT
AS
BEGIN
/* declare sessions keys that are safe for multiple sessions on a single connection */
@matthew-n
matthew-n / PossibleBadOptions.sql
Last active May 18, 2021 20:39 — forked from tcartwright/PossibleBadOptions.md
Possible bad SQL SERVER OPTIONS in server, db, tables, procs, columns
--SELECT * FROM sys.databases
SELECT 'SERVER OPTIONS' AS 'container'
/*
Author: Tim Cartwright
Purpose: Allows you to check the server, and client SET options
https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-the-user-options-server-configuration-option
1 DISABLE_DEF_CNST_CHK Controls interim or deferred constraint checking.
@matthew-n
matthew-n / jq-cheetsheet.md
Created June 10, 2021 21:30 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

These are my red gate snippets.
The powershell file "PushSnippets.ps1" is used to update them.
It can be modified so as to push your own snippets once you create a GIST for them.