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
/* | |
Script name: Purge SSIS Catalog log tables | |
Author: Tim Mitchell (www.TimMitchell.net) | |
Date: 12/19/2018 | |
Purpose: This script will remove most of the operational information from the SSIS catalog. The | |
internal.operations and internal.executions tables, as well as their dependencies, | |
will be purged of all data with an operation created_time value older than the number | |
of days specified in the RETENTION_WINDOW setting of the SSIS catalog. | |
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 ScriptMain() | |
{ | |
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); | |
} | |
public Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) | |
{ | |
Assembly assembly = null; | |
try | |
{ |
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
{ | |
"background" : "#282828", | |
"black" : "#282828", | |
"blue" : "#458588", | |
"brightBlack" : "#928374", | |
"brightBlue" : "#83A598", | |
"brightCyan" : "#8EC07C", | |
"brightGreen" : "#B8BB26", | |
"brightPurple" : "#D3869B", | |
"brightRed" : "#FB4934", |
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
declare @tableName varchar(200) | |
declare @columnName varchar(200) | |
declare @nullable varchar(50) | |
declare @datatype varchar(50) | |
declare @maxlen int | |
declare @sType varchar(50) | |
declare @sProperty varchar(200) | |
DECLARE table_cursor CURSOR FOR |
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
-- This script deploys the dbo.Concatenate() aggregate function on SQL Server. This is compiled from the code Concatenate.cs below. | |
CREATE ASSEMBLY [concat] | |
FROM 0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C010300E3EE2A540000000000000000E00002210B010B00000C00000006000000000000AE2B0000002000000040000000000010002000000002000004000000000000000400000000000000008000000002000000000000030040850000100000100000000010000010000000000000100000000000000000000000602B00004B000000004000009003000000000000000000000000000000000000006000000C000000282A00001C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E74657874000000B40B000000200000000C000000020000000000000000000000000000200000602E7273726300000090030000004 |
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
GO | |
PRINT N'Creating [SQL_CLR_Functions]...for SQL Server 2012 and 2014.'; | |
GO | |
CREATE ASSEMBLY [SQL_CLR_Functions] | |
AUTHORIZATION [dbo] | |
FROM 0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C01030041212C550000000000000000E00002210B010B000008000000060000000000002E270000002000000040000000000010002000000002000004000000000000000400000000000000008000000002000000000000030040850000100000100000000010000010000000000000100000000000000000000000D42600005700000000400000C802000000000000000000000000000000000000006000000C0000009C2500001C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E7465787400000034070000002000000008000000020000000000000000000000000000200000602E72737263000000C8020000004000000004000000 |
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 FUNCTION [dbo].[udf_HTMLDecode] (@text NVARCHAR(MAX)) | |
RETURNS NVARCHAR(MAX) AS | |
BEGIN | |
DECLARE @vcResult NVARCHAR(MAX) | |
DECLARE @vcCrLf NVARCHAR(2) | |
DECLARE @siPos SMALLINT | |
DECLARE @vcEncoded NVARCHAR(7) | |
DECLARE @siChar SMALLINT | |
SET @vcCrLF = CHAR(13) + CHAR(10) |
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 Exercises | |
GO | |
/* *********************************************************************************************** | |
* | |
* CRONTAB EXPANDER | |
* | |
* ***********************************************************************************************/ | |
/************************************************************************************************** |
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
---Today | |
SELECT GETDATE() 'Today' | |
----Yesterday | |
SELECT DATEADD(d,-1,GETDATE()) 'Yesterday' | |
----First Day of Current Week | |
SELECT DATEADD(wk,DATEDIFF(wk,0,GETDATE()),0) 'First Day of Current Week' | |
----Last Day of Current Week |
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 dbo.humanizeDate(getdate()-1.56) | |
SELECT dbo.humanizeDate(getdate()-1) | |
SELECT dbo.humanizeDate(getdate()-.56) | |
SELECT dbo.humanizeDate(getdate()+22.56) |