Skip to content

Instantly share code, notes, and snippets.

View MattiasSp's full-sized avatar

Mattias Spångmyr MattiasSp

View GitHub Profile
@MattiasSp
MattiasSp / populate_geometry_columns_table.sql
Last active October 30, 2019 10:01 — forked from christippett/populate_geometry_columns_table.sql
MS SQL stored procedure to populate `geometry_columns` table. This table is used by QGIS to identify tables with spatial data.
-- =============================================
-- Author: Chris Tippett
-- Create date: 2014-08-12
-- Description: Detect columns with geometry datatypes and add them to [dbo].[geometry_columns]
-- =============================================
CREATE PROCEDURE [dbo].[Populate_Geometry_Columns] @schema VARCHAR(MAX) = '', @table VARCHAR(MAX) = ''
AS
BEGIN
SET NOCOUNT ON;
@MattiasSp
MattiasSp / cumulative_string_concatenation.sql
Created April 16, 2020 06:14
An SQL script that uses recursive CTE to do ordered cumulative string concatenation
-- ============================================================================
-- Filename: cumulative_string_concatenation.sql
--
-- Author: Mattias Spångmyr
-- Create date: 2020-04-16
-- Description: Uses a recursive common table expression (recursive CTE) to
-- cumulatively concatenace string values that have a defined
-- order and share a common identifier.
--
-- SQL Server