Skip to content

Instantly share code, notes, and snippets.

View johanrex's full-sized avatar

Johan Rex johanrex

  • Helsingborg, Sweden.
View GitHub Profile
@johanrex
johanrex / SQL moving average.sql
Created March 15, 2019 13:33
SQL moving average
WITH cte
AS (SELECT
1 AS n -- anchor member
,Cast(Cast(CRYPT_GEN_RANDOM(4) as INT) as Float) AS rnd
UNION ALL
SELECT
n + 1 -- recursive member
,Cast(Cast(CRYPT_GEN_RANDOM(4) as INT) as Float)
FROM cte
@johanrex
johanrex / gist:b6b501dfb29c65fd90b3033989acf509
Created January 25, 2019 09:13
sql server exact string match
DECLARE @nrRows INT;
SET @nrRows=1000000;
--drop table if exists tmp;
create table tmp
(
idString varchar(36)
);