CREATE PROCEDURE CLR$ITER_Int_COUNT_test
                 @str nvarchar(MAX),
                 @retdata  bit = 1,
                 @tookms   int = NULL OUTPUT AS

DECLARE @start datetime2(3)
SELECT @start = sysdatetime()

DECLARE @cnt bigint
SELECT @cnt = SUM(len(word))
FROM   usrdictwords u
JOIN   CLR_intlist_iter(@str, DEFAULT) AS a ON u.wordno = a.number

SELECT @tookms = datediff(ms, @start, sysdatetime());


go

CREATE PROCEDURE CLR$ITER_Int_EXISTS_test @str nvarchar(MAX), @retdata bit = 1, @tookms int = NULL OUTPUT AS DECLARE @start datetime2(3) SELECT @start = sysdatetime() INSERT #Int_JOIN (word) SELECT u.word FROM usrdictwords u WHERE EXISTS (SELECT * FROM CLR_intlist_iter(@str, DEFAULT) AS a WHERE u.wordno = a.number) SELECT @tookms = datediff(ms, @start, sysdatetime()); IF @retdata = 1 SELECT word FROM #Int_JOIN TRUNCATE TABLE #Int_JOIN go
CREATE PROCEDURE CLR$ITER_Int_JOIN_test @str nvarchar(MAX), @retdata bit = 1, @tookms int = NULL OUTPUT AS DECLARE @start datetime2(3) SELECT @start = sysdatetime() INSERT #Int_JOIN (word) SELECT u.word FROM usrdictwords u JOIN CLR_intlist_iter(@str, DEFAULT) AS a ON u.wordno = a.number SELECT @tookms = datediff(ms, @start, sysdatetime()); IF @retdata = 1 SELECT word FROM #Int_JOIN TRUNCATE TABLE #Int_JOIN go
CREATE PROCEDURE CLR$ITER_Int_UNPACK_test @str nvarchar(MAX), @retdata bit = 1, @tookms int = NULL OUTPUT AS DECLARE @start datetime2(3) SELECT @start = sysdatetime() INSERT #Int_UNPACK (number) SELECT number FROM CLR_intlist_iter(@str, DEFAULT) SELECT @tookms = datediff(ms, @start, sysdatetime()); IF @retdata = 1 SELECT number FROM #Int_UNPACK TRUNCATE TABLE #Int_UNPACK go
CREATE PROCEDURE CLR$ITER_Str_COUNT_test @str nvarchar(MAX), @retdata bit = 1, @tookms int = NULL OUTPUT AS DECLARE @start datetime2(3) SELECT @start = sysdatetime() DECLARE @cnt bigint SELECT @cnt = SUM(len(guid)) FROM usrdictwords u JOIN CLR_charlist_iter(@str, DEFAULT) AS a ON u.word = a.str SELECT @tookms = datediff(ms, @start, sysdatetime()); go
CREATE PROCEDURE CLR$ITER_Str_EXISTS_test @str nvarchar(MAX), @retdata bit = 1, @tookms int = NULL OUTPUT AS DECLARE @start datetime2(3) SELECT @start = sysdatetime() INSERT #Str_JOIN (wordno, guid) SELECT u.wordno, u.guid FROM usrdictwords u WHERE EXISTS (SELECT * FROM CLR_charlist_iter(@str, DEFAULT) AS a WHERE u.word = a.str) SELECT @tookms = datediff(ms, @start, sysdatetime()); IF @retdata = 1 SELECT wordno FROM #Str_JOIN TRUNCATE TABLE #Str_JOIN go
CREATE PROCEDURE CLR$ITER_Str_JOIN_test @str nvarchar(MAX), @retdata bit = 1, @tookms int = NULL OUTPUT AS DECLARE @start datetime2(3) SELECT @start = sysdatetime() INSERT #Str_JOIN (wordno, guid) SELECT u.wordno, u.guid FROM usrdictwords u JOIN CLR_charlist_iter(@str, DEFAULT) AS a ON u.word = a.str SELECT @tookms = datediff(ms, @start, sysdatetime()); IF @retdata = 1 SELECT wordno FROM #Str_JOIN TRUNCATE TABLE #Str_JOIN go
CREATE PROCEDURE CLR$ITER_Str_UNPACK_test @str nvarchar(MAX), @retdata bit = 1, @tookms int = NULL OUTPUT AS DECLARE @start datetime2(3) SELECT @start = sysdatetime() INSERT #Str_UNPACK (word) SELECT str FROM CLR_charlist_iter(@str, DEFAULT) SELECT @tookms = datediff(ms, @start, sysdatetime()); IF @retdata = 1 SELECT word FROM #Str_UNPACK TRUNCATE TABLE #Str_UNPACK go