Skip to content

Instantly share code, notes, and snippets.

View jerfowler's full-sized avatar

Jeremy Fowler jerfowler

View GitHub Profile
@jerfowler
jerfowler / ImageRight File Heirarchy.sql
Created August 14, 2018 04:11
CTE query to print out the ImageRight file types and the folder/document heirarchy
USE [ImageRight]
GO
WITH Source as (
SELECT FT.[filetypeid]
,FT.[itemid]
,FT.[parentid]
,FT.[single]
,FT.[objecttypeid]
,CASE O.[classid] WHEN -3 THEN 'File' WHEN -2 THEN 'Folder' WHEN -1 THEN 'Document' END as [type]
@jerfowler
jerfowler / DQ-GL_Detail_Custom.sql
Last active December 16, 2015 10:39
GL_Detail_Custom Data source for Document Designer
INSERT INTO [CIS].[dbo].[DocumentQuery] ([Name] ,[SQL] ,[ActiveFlag])
VALUES
('GL_Detail_Custom'
,'SELECT GL.[Code]
,GL.[CodeDescription]
,GL.[DateAdded]
,GL.[DateDropped]
,GL.[Sales] as [Exposure]
,GL.[FlagDropped]
,GL.[FlagRackleyRated]
@jerfowler
jerfowler / dvReportActivityDump.sql
Last active December 16, 2015 03:09
Activity Dump Report View
USE [CIS]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[dvReportActivityDump]
@jerfowler
jerfowler / unprotect.bat
Created March 28, 2013 21:42
Advanced PDF Password Recovery.vbs
@ECHO OFF
C:\WINDOWS\system32\wscript.exe unprotect.vbs
@jerfowler
jerfowler / gist:5240737
Last active December 15, 2015 09:49
Check for duplicate InvoiceIDs
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
USE CIS
GO
-- =============================================
-- Author: Jeremy Fowler
-- Create date: 3/25/2013
@jerfowler
jerfowler / Leap Year
Last active December 14, 2015 14:19
This is how I calculate First/Last day of any given month and prior year corresponding dates.
DECLARE
@Date DateTime,
@FirstDay DateTime,
@LastDay DateTime,
@PriorFirstDay DateTime,
@PriorLastDay DateTime
SET @Date='2/15/2013'
SELECT @FirstDay = CAST(MONTH(@Date) as varchar(2))+'/1/'+CAST(YEAR(@Date) as varchar(4))