Skip to content

Instantly share code, notes, and snippets.

View GeorgeDellinger's full-sized avatar

GeorgeDellinger

View GitHub Profile
@GeorgeDellinger
GeorgeDellinger / Aggregation.js
Last active October 18, 2016 19:59
MongoDB aggregation examples
# Not only have we been adding wands, but our users have been adding new ones daily! Lets create a list of all the unique wand makers in our database.
db.wands.aggregate(
{
"$group": {
"_id": "$maker"
}
}
)
@GeorgeDellinger
GeorgeDellinger / Workflow
Created February 10, 2016 15:45
Workflow Debugging problem in Visual Studio 2015
using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
WorkflowInstance wfi = workflowRuntime.CreateWorkflow(typeof (WorkflowActivity), parameters);
wfi.Start();
}
@GeorgeDellinger
GeorgeDellinger / App.Config
Created February 5, 2016 18:19
Disabling the Visual Studio Debugger for Windows Workflow Foundation (Legacy)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
<add name="DisableWorkflowDebugging" value="true"/>
</switches>
</system.diagnostics>
</configuration>
@GeorgeDellinger
GeorgeDellinger / FindColumnAcrossDBs
Created November 30, 2014 03:28
Find a column in all dbs on server
Create table #yourcolumndetails(DBaseName varchar(100), TableSchema varchar(50), TableName varchar(100),ColumnName varchar(100), DataType varchar(100), CharMaxLength varchar(100))
EXEC sp_MSForEachDB @command1='USE [?];
INSERT INTO #yourcolumndetails SELECT
Table_Catalog
,Table_Schema
,Table_Name
,Column_Name
,Data_Type
,Character_Maximum_Length
@GeorgeDellinger
GeorgeDellinger / GetInstance.cs
Created March 10, 2014 13:01
Return instance of Interface that has a method that returns true
public static ISomeInterface GetInstance(string record)
{
var instances = from t in Assembly.GetExecutingAssembly().GetTypes()
where t.GetInterfaces().Contains(typeof(ISomeInterface))
&& t.GetConstructor(Type.EmptyTypes) != null
orderby t.Name
select Activator.CreateInstance(t) as ISomeInterface;
return (from instance in instances
@GeorgeDellinger
GeorgeDellinger / sp_SearchStoredProcedures.sql
Created July 9, 2013 21:18
sp_SearchStoredProcedures - Search all stored procedures for a string value
USE [master]
GO
/****** Object: StoredProcedure [dbo].[sp_SearchStoredProcedures] Script Date: 05/17/2013 08:02:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
if exists (select * from sysobjects where id = object_id(N'[dbo].[sp_SearchStoredProcedures]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_SearchStoredProcedures]
@GeorgeDellinger
GeorgeDellinger / sp_FindTablesIncludeSynonyms.sql
Created July 9, 2013 21:08
sp_FindTablesIncludeSynonyms - finds all tables given a wildcard in the current database and its synonyms.
USE [master]
GO
/****** Object: StoredProcedure [dbo].[sp_FindTablesIncludeSynonyms] Script Date: 05/17/2013 08:02:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
if exists (select * from sysobjects where id = object_id(N'[dbo].[sp_FindTablesIncludeSynonyms]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_FindTablesIncludeSynonyms]
@GeorgeDellinger
GeorgeDellinger / sp_generate_inserts.sql
Last active October 21, 2019 10:13
My copy of sp_generate_inserts scripts..... Only changes: Commented out the calls to sp_MS_upd_sysobj_category.Added sp_MS_marksystemobject to end of script.
SET NOCOUNT ON
GO
PRINT 'Using Master database'
USE master
GO
PRINT 'Checking for the existence of this procedure'
IF (SELECT OBJECT_ID('dbo.sp_generate_inserts','P')) IS NOT NULL --means, the procedure already exists
BEGIN
@GeorgeDellinger
GeorgeDellinger / sp_FindColumnsIncludeSynonyms.sql
Last active December 17, 2015 10:28
sp_FindColums from current database along with any synonym tables.
USE [master]
GO
/****** Object: StoredProcedure [dbo].[sp_FindColumnsIncludeSynonyms] Script Date: 05/17/2013 08:02:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
if exists (select * from sysobjects where id = object_id(N'[dbo].[sp_FindColumnsIncludeSynonyms]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_FindColumnsIncludeSynonyms]
@GeorgeDellinger
GeorgeDellinger / UnusedColumns.sql
Created May 6, 2013 17:11
Find unused Sql columns
SET NOCOUNT ON
declare @tempTable table
(
TableSchema nvarchar(256),
TableName nvarchar(256),
ColumnName sysname
);
declare @sql nvarchar(4000);
declare @tableSchema nvarchar(256);