Skip to content

Instantly share code, notes, and snippets.

@johanrex
Created January 25, 2019 09:13
Show Gist options
  • Save johanrex/b6b501dfb29c65fd90b3033989acf509 to your computer and use it in GitHub Desktop.
Save johanrex/b6b501dfb29c65fd90b3033989acf509 to your computer and use it in GitHub Desktop.
sql server exact string match
DECLARE @nrRows INT;
SET @nrRows=1000000;
--drop table if exists tmp;
create table tmp
(
idString varchar(36)
);
WITH guidRows ( n ) AS (
SELECT 1 UNION ALL
SELECT 1 + n FROM guidRows WHERE n < @nrRows )
insert into tmp
select
convert(varchar(36), NEWID()) as idString
FROM
guidRows
OPTION ( MAXRECURSION 0 )
SET STATISTICS XML ON;
select * from tmp where idString = 'kalleanka'
SET STATISTICS XML OFF;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment