jq is useful to slice, filter, map and transform structured json data.
brew install jq
| 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 */ |
| --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. |
| 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. |