SqlQuantumLeap

SQLCLR UDA for Longest Common Substring - Testing

Mar 17th, 2016
196
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     This script relates to the following DBA.StackExchange answer:
  3.     http://dba.stackexchange.com/questions/131759/is-there-a-sql-server-implementation-of-the-longest-common-substring-problem/131766#131766
  4.  
  5.     This script provides several performance / scalability tests for the [LongestCommonSubstring] User-Defined Aggregate (UDA).
  6.  
  7.     A T-SQL installation script (no external DLL) containing only the User-Defined Aggregate (UDA) is located at:
  8.     http://pastebin.com/wnLwT1GM
  9.  
  10.     The source code for the [LongestCommonSubstring] User-Defined Aggregate (UDA) is located at:
  11.     http://pastebin.com/ceDypBp0
  12.  
  13.     Date: 2016-03-17
  14.     Version: 1.0.3
  15.  
  16.     For more functions like this, please visit: http://SQLsharp.com
  17.  
  18.     Copyright (c) 2016 Sql Quantum Leap. All rights reserved.
  19.     http://www.SqlQuantumLeap.com
  20. */
  21.  
  22.  
  23.  
  24. /* -- CLEAN UP (if needed)
  25. USE [ {your_database_name} ];
  26. */
  27.  
  28. SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON;
  29. SET NOCOUNT ON;
  30. GO
  31.  
  32. USE [ {your_database_name} ];
  33. GO
  34.  
  35. -------------------------------------------------------------------------------------
  36. --                   Original @MisterMagoo Test
  37. -------------------------------------------------------------------------------------
  38.  
  39. /* -- Highlight and execute the following once
  40.  
  41. IF (OBJECT_ID('tempdb..#ShortStrings') IS NOT NULL)
  42. BEGIN
  43.     PRINT N'Dropping #ShortStrings table...';
  44.     DROP TABLE #ShortStrings;
  45. END;
  46.  
  47. PRINT N'Creating and Populating #ShortStrings table...';
  48.  
  49. CREATE TABLE #ShortStrings
  50. (
  51.     [ShortStringsID] INT NOT NULL IDENTITY(1, 1) PRIMARY KEY,
  52.     [String] sysname COLLATE DATABASE_DEFAULT NULL
  53. );
  54.  
  55. INSERT INTO #ShortStrings ([String])
  56.     SELECT sac.[Name] AS [String]
  57.     FROM   master.sys.all_columns sac
  58.     CROSS JOIN  master.sys.indexes si1
  59.     CROSS JOIN  master.sys.indexes si2
  60.     WHERE  sac.[Name] LIKE N'%refer%';
  61. -- 1,213,488 rows on SQL Server 2014
  62.  
  63. SELECT COUNT(*) FROM #ShortStrings;
  64.  
  65. */
  66.  
  67. /* Any NULLs mean there is not a "longest common string" */
  68. IF (EXISTS(SELECT 1 FROM #ShortStrings WHERE [String] IS NULL))
  69. BEGIN
  70.     SELECT NULL AS [Longest Common Substrings];
  71.     RETURN;
  72. END;
  73.  
  74. /* We need to know number of rows in the sample and the length of the shortest string
  75.    as the longest common substring cannot be longer than the shortest string in the set */
  76.  
  77. DECLARE @TotalRows INT,
  78.         @MinLen TINYINT,
  79.         @MatchesFound INT = 0;
  80.  
  81. SELECT  @MinLen = MIN(LEN([String])),
  82.         @TotalRows = COUNT(DISTINCT [String])
  83. FROM        #ShortStrings;
  84.  
  85. RAISERROR(N'Maximum Possible Length: %d; Total Distinct Rows: %d', 0, 0, @MinLen, @TotalRows) WITH NOWAIT;
  86.  
  87. DECLARE @Matches TABLE
  88. (
  89.     [String] sysname COLLATE DATABASE_DEFAULT NULL
  90. );
  91.  
  92. /* Check backwards from the longest possible string to the shortest and break when we find a match */
  93. /* You might want to check the air conditioner is switched on here */
  94.  
  95. WHILE (@MinLen > 0 AND @MatchesFound = 0)
  96. BEGIN
  97.     RAISERROR(N'Processing strings of length: %d', 0, 0, @MinLen) WITH NOWAIT;
  98.  
  99.    /* this method is "brute force"
  100.       1. find all substrings for each input string
  101.       2. pick the first substring that appears in every input string
  102.          we find this by grouping, counting and comparing to the number of input strings
  103.    */
  104.     INSERT INTO @Matches ([String])
  105.         SELECT [Match]
  106.         FROM (
  107.             SELECT [String], SUBSTRING([String], T.[N], @MinLen) AS [Match]
  108.             FROM    #ShortStrings
  109.             CROSS APPLY ( SELECT LEN([String]) - @MinLen + 1 ) a(L)
  110.             CROSS APPLY (
  111.                         SELECT TOP(a.[L]) V.[N]
  112.                         FROM (
  113.                                 VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),
  114.                                 (18),(19),(20),(21),(22),(23),(24),(25),(26),(27),(28),(29),(30),(31),(32),(33),(34),
  115.                                 (35),(36),(37),(38),(39),(40),(41),(42),(43),(44),(45),(46),(47),(48),(49),(50)
  116.                             ) V(N)
  117.                     ) T(N)
  118.             ) Matches(String, Match)
  119.         GROUP BY [Match]
  120.         HAVING COUNT(DISTINCT [String]) = @TotalRows;
  121.  
  122.     SET @MatchesFound = @@ROWCOUNT;
  123.  
  124.     /* Decrement so next time we check for a shorter match */
  125.     SET @MinLen = (@MinLen - 1);
  126. END;
  127.  
  128. /* Display the results */
  129. SELECT  [String] AS [Longest Common Substrings]
  130. FROM        @Matches;
  131. -- Longest Common Substring: referen
  132. -- 1:13 (across 3 successive executions AFTER the initial execution)
  133.  
  134. -----------------
  135.  
  136. SELECT  dbo.LongestCommonSubstring([String], 0)
  137. FROM    #ShortStrings;
  138. -- <Items Merged="False"><Item>referen</Item></Items>
  139. -- 0:12 (across 3 successive executions AFTER the initial execution)
  140.  
  141. SELECT  dbo.LongestCommonSubstring([String], 1)
  142. FROM    #ShortStrings;
  143. -- 0:12 (across 3 successive executions AFTER the initial execution)
  144. /*
  145. <Items Merged="False">
  146.   <Item IsLongest="True">referen</Item>
  147.   <Item IsLongest="False">refere</Item>
  148.   <Item IsLongest="False">eferen</Item>
  149.   <Item IsLongest="False">refer</Item>
  150.   <Item IsLongest="False">efere</Item>
  151.   <Item IsLongest="False">feren</Item>
  152.   <Item IsLongest="False">refe</Item>
  153.   <Item IsLongest="False">efer</Item>
  154.   <Item IsLongest="False">fere</Item>
  155.   <Item IsLongest="False">eren</Item>
  156.   <Item IsLongest="False">ref</Item>
  157.   <Item IsLongest="False">efe</Item>
  158.   <Item IsLongest="False">fer</Item>
  159.   <Item IsLongest="False">ere</Item>
  160.   <Item IsLongest="False">ren</Item>
  161.   <Item IsLongest="False">re</Item>
  162.   <Item IsLongest="False">ef</Item>
  163.   <Item IsLongest="False">fe</Item>
  164.   <Item IsLongest="False">er</Item>
  165.   <Item IsLongest="False">en</Item>
  166.   <Item IsLongest="False">r</Item>
  167.   <Item IsLongest="False">e</Item>
  168.   <Item IsLongest="False">f</Item>
  169.   <Item IsLongest="False">n</Item>
  170.   <Item IsLongest="False">c</Item>
  171.   <Item IsLongest="False">_</Item>
  172. </Items>
  173. */
  174. GO
  175. -------------------------------------------------------------------------------------
  176. --                   Modified @MisterMagoo Test:
  177. --                     Same code and base data, but add to each row: a tie-for-first-place
  178. --                     substring, a 4 character common substring, and 3 random characters.
  179. -------------------------------------------------------------------------------------
  180.  
  181. /* -- Highlight and execute the following once
  182.  
  183. IF (OBJECT_ID('tempdb..#MultipleMatches') IS NOT NULL)
  184. BEGIN
  185.     PRINT N'Dropping #MultipleMatches table...';
  186.     DROP TABLE #MultipleMatches;
  187. END;
  188.  
  189. PRINT N'Creating and Populating #MultipleMatches table...';
  190.  
  191. CREATE TABLE #MultipleMatches
  192. (
  193.     [MultipleMatchesID] INT NOT NULL IDENTITY(1, 1) PRIMARY KEY,
  194.     [String] sysname COLLATE DATABASE_DEFAULT NULL
  195. );
  196.  
  197. INSERT INTO #MultipleMatches ([String])
  198.     SELECT ss.[String] + '1234567' + CONVERT(VARCHAR(5), CRYPT_GEN_RANDOM(3)) + '_Yo!' AS [String]
  199.     FROM   #ShortStrings ss
  200. -- 1,213,488 rows on SQL Server 2014
  201.  
  202. SELECT COUNT(*) FROM #MultipleMatches;
  203.  
  204. */
  205.  
  206.  
  207.  
  208. /* Any NULLs mean there is not a "longest common string" */
  209. IF (EXISTS(SELECT 1 FROM #MultipleMatches WHERE [String] IS NULL))
  210. BEGIN
  211.     SELECT NULL AS [Longest Common Substrings];
  212.     RETURN;
  213. END;
  214.  
  215. /* We need to know number of rows in the sample and the length of the shortest string
  216.    as the longest common substring cannot be longer than the shortest string in the set */
  217.  
  218. DECLARE @TotalRows INT,
  219.         @MinLen TINYINT,
  220.         @MatchesFound INT = 0;
  221.  
  222. SELECT  @MinLen = MIN(LEN([String])),
  223.         @TotalRows = COUNT(DISTINCT [String])
  224. FROM        #MultipleMatches;
  225.  
  226. RAISERROR(N'Maximum Possible Length: %d; Total Distinct Rows: %d', 0, 0, @MinLen, @TotalRows) WITH NOWAIT;
  227.  
  228. DECLARE @Matches TABLE
  229. (
  230.     [String] sysname COLLATE DATABASE_DEFAULT NULL
  231. );
  232.  
  233. /* Check backwards from the longest possible string to the shortest and break when we find a match */
  234. /* You might want to check the air conditioner is switched on here */
  235.  
  236. WHILE (@MinLen > 0 AND @MatchesFound = 0)
  237. BEGIN
  238.     RAISERROR(N'Processing strings of length: %d', 0, 0, @MinLen) WITH NOWAIT;
  239.  
  240.    /* this method is "brute force"
  241.       1. find all substrings for each input string
  242.       2. pick the first substring that appears in every input string
  243.          we find this by grouping, counting and comparing to the number of input strings
  244.    */
  245.     INSERT INTO @Matches ([String])
  246.         SELECT [Match]
  247.         FROM (
  248.             SELECT [String], SUBSTRING([String], T.[N], @MinLen) AS [Match]
  249.             FROM    #MultipleMatches
  250.             CROSS APPLY ( SELECT LEN([String]) - @MinLen + 1 ) a(L)
  251.             CROSS APPLY (
  252.                         SELECT TOP(a.[L]) V.[N]
  253.                         FROM (
  254.                                 VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),
  255.                                 (18),(19),(20),(21),(22),(23),(24),(25),(26),(27),(28),(29),(30),(31),(32),(33),(34),
  256.                                 (35),(36),(37),(38),(39),(40),(41),(42),(43),(44),(45),(46),(47),(48),(49),(50)
  257.                             ) V(N)
  258.                     ) T(N)
  259.             ) Matches(String, Match)
  260.         GROUP BY [Match]
  261.         HAVING COUNT(DISTINCT [String]) = @TotalRows;
  262.  
  263.     SET @MatchesFound = @@ROWCOUNT;
  264.  
  265.     /* Decrement so next time we check for a shorter match */
  266.     SET @MinLen = (@MinLen - 1);
  267. END;
  268.  
  269. /* Display the results */
  270. SELECT  [String] AS [Longest Common Substrings]
  271. FROM        @Matches;
  272. -- ?? never returned
  273. -- ?? killed after 23 minutes. Only process strings of lengths: 27, 26, and 25
  274.  
  275. -----------------
  276.  
  277. SELECT  dbo.LongestCommonSubstring([String], 0)
  278. FROM    #MultipleMatches;
  279. -- <Items Merged="False"><Item>referen</Item><Item>1234567</Item></Items>
  280. -- 1:09 (across 3 successive executions AFTER the initial execution)
  281.  
  282. SELECT  dbo.LongestCommonSubstring([String], 1)
  283. FROM    #MultipleMatches;
  284. -- 1:10 (across 3 successive executions AFTER the initial execution)
  285. /*
  286. <Items Merged="False">
  287.   <Item IsLongest="True">referen</Item>
  288.   <Item IsLongest="True">1234567</Item>
  289.   <Item IsLongest="False">refere</Item>
  290.   <Item IsLongest="False">eferen</Item>
  291.   <Item IsLongest="False">123456</Item>
  292.   <Item IsLongest="False">234567</Item>
  293.   <Item IsLongest="False">refer</Item>
  294.   <Item IsLongest="False">efere</Item>
  295.   <Item IsLongest="False">feren</Item>
  296.   <Item IsLongest="False">12345</Item>
  297.   <Item IsLongest="False">23456</Item>
  298.   <Item IsLongest="False">34567</Item>
  299.   <Item IsLongest="False">refe</Item>
  300.   <Item IsLongest="False">efer</Item>
  301.   <Item IsLongest="False">fere</Item>
  302.   <Item IsLongest="False">eren</Item>
  303.   <Item IsLongest="False">1234</Item>
  304.   <Item IsLongest="False">2345</Item>
  305.   <Item IsLongest="False">3456</Item>
  306.   <Item IsLongest="False">4567</Item>
  307.   <Item IsLongest="False">_Yo!</Item>
  308.   <Item IsLongest="False">ref</Item>
  309.   <Item IsLongest="False">efe</Item>
  310.   <Item IsLongest="False">fer</Item>
  311.   <Item IsLongest="False">ere</Item>
  312.   <Item IsLongest="False">ren</Item>
  313.   <Item IsLongest="False">123</Item>
  314.   <Item IsLongest="False">234</Item>
  315.   <Item IsLongest="False">345</Item>
  316.   <Item IsLongest="False">456</Item>
  317.   <Item IsLongest="False">567</Item>
  318.   <Item IsLongest="False">_Yo</Item>
  319.   <Item IsLongest="False">Yo!</Item>
  320.   <Item IsLongest="False">re</Item>
  321.   <Item IsLongest="False">ef</Item>
  322.   <Item IsLongest="False">fe</Item>
  323.   <Item IsLongest="False">er</Item>
  324.   <Item IsLongest="False">en</Item>
  325.   <Item IsLongest="False">12</Item>
  326.   <Item IsLongest="False">23</Item>
  327.   <Item IsLongest="False">34</Item>
  328.   <Item IsLongest="False">45</Item>
  329.   <Item IsLongest="False">56</Item>
  330.   <Item IsLongest="False">67</Item>
  331.   <Item IsLongest="False">_Y</Item>
  332.   <Item IsLongest="False">Yo</Item>
  333.   <Item IsLongest="False">o!</Item>
  334.   <Item IsLongest="False">r</Item>
  335.   <Item IsLongest="False">e</Item>
  336.   <Item IsLongest="False">f</Item>
  337.   <Item IsLongest="False">n</Item>
  338.   <Item IsLongest="False">c</Item>
  339.   <Item IsLongest="False">_</Item>
  340.   <Item IsLongest="False">1</Item>
  341.   <Item IsLongest="False">2</Item>
  342.   <Item IsLongest="False">3</Item>
  343.   <Item IsLongest="False">4</Item>
  344.   <Item IsLongest="False">5</Item>
  345.   <Item IsLongest="False">6</Item>
  346.   <Item IsLongest="False">7</Item>
  347.   <Item IsLongest="False">Y</Item>
  348.   <Item IsLongest="False">o</Item>
  349.   <Item IsLongest="False">!</Item>
  350. </Items>
  351. */
  352. GO
  353.  
  354. -------------------------------------------------------------------------------------
  355. --                   Solomonified @MisterMagoo Technique:
  356. --                     Same data as "Modifed @MisterMagoo Test", but attempt to extract
  357. --                     substrings from 2 entries into a temp table, then find which ones
  358. --                     are present across all rows, then return the longest one(s).
  359. -------------------------------------------------------------------------------------
  360.  
  361. DECLARE @ReturnAllSubstrings BIT = 0;
  362.  
  363. IF (OBJECT_ID('tempdb..#Substrings') IS NOT NULL)
  364. BEGIN
  365.     PRINT N'Dropping #Substrings table...';
  366.     DROP TABLE #Substrings;
  367. END;
  368.  
  369. PRINT N'Creating #Substrings table...';
  370.  
  371. CREATE TABLE #Substrings
  372. (
  373.     [SubstringsID] INT NOT NULL IDENTITY(1, 1) PRIMARY KEY,
  374.     [String] sysname COLLATE DATABASE_DEFAULT NULL
  375. );
  376.  
  377.  
  378. /* Any NULLs mean there is not a "longest common string" */
  379. IF (EXISTS(SELECT 1 FROM #MultipleMatches WHERE [String] IS NULL))
  380. BEGIN
  381.     RETURN;
  382. END;
  383.  
  384. /* We need to know number of rows in the sample and the length of the shortest string
  385.    as the longest common substring cannot be longer than the shortest string in the set */
  386.  
  387. DECLARE @TotalRows INT,
  388.         @MinLen TINYINT,
  389.         @MatchesFound INT = 0;
  390.  
  391. SELECT  @MinLen = MIN(LEN([String])),
  392.         @TotalRows = COUNT(*)
  393. FROM        #MultipleMatches;
  394.  
  395. RAISERROR(N'Maximum Possible Length: %d; Total Distinct Rows: %d', 0, 0, @MinLen, @TotalRows) WITH NOWAIT;
  396.  
  397. /* Check backwards from the longest possible string to the shortest and break when we find a match */
  398.  
  399. DECLARE @SampleSet TABLE
  400. (
  401.     [String] sysname COLLATE DATABASE_DEFAULT NULL
  402. );
  403.  
  404. INSERT INTO @SampleSet ([String])
  405.     SELECT  TOP (2) [String]
  406.     FROM        #MultipleMatches
  407.     GROUP BY    [String]
  408.     ORDER BY    LEN([String]) ASC;
  409.  
  410. WHILE (@MinLen > 0)
  411. BEGIN
  412.     RAISERROR(N'Processing strings of length: %d', 0, 0, @MinLen) WITH NOWAIT;
  413.  
  414.    /* this method is "brute force"
  415.       1. find all substrings for each input string
  416.       2. pick the first substring that appears in every input string
  417.          we find this by grouping, counting and comparing to the number of input strings
  418.    */
  419.     INSERT INTO #Substrings ([String])
  420.         SELECT [Match]
  421.         FROM (
  422.             SELECT [String], SUBSTRING([String], T.[N], @MinLen) AS [Match]
  423.             FROM    @SampleSet
  424.             CROSS APPLY ( SELECT LEN([String]) - @MinLen + 1 ) a(L)
  425.             CROSS APPLY (
  426.                         SELECT TOP(a.[L]) V.[N]
  427.                         FROM (
  428.                                 VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),
  429.                                 (18),(19),(20),(21),(22),(23),(24),(25),(26),(27),(28),(29),(30),(31),(32),(33),(34),
  430.                                 (35),(36),(37),(38),(39),(40),(41),(42),(43),(44),(45),(46),(47),(48),(49),(50)
  431.                             ) V(N)
  432.                     ) T(N)
  433.             ) Matches(String, Match)
  434.         GROUP BY [Match]
  435.         HAVING COUNT(DISTINCT [String]) = 2;
  436.  
  437.     SET @MatchesFound = @@ROWCOUNT;
  438.  
  439.     /* Decrement so next time we check for a shorter match */
  440.     SET @MinLen = (@MinLen - 1);
  441. END;
  442.  
  443. --SELECT * FROM #Substrings ORDER BY LEN([String]) DESC, SubstringsID ASC;
  444.  
  445. DECLARE @Matches TABLE
  446. (
  447.     [String] sysname COLLATE DATABASE_DEFAULT NULL,
  448.     [IsLongest] BIT NOT NULL
  449. );
  450.  
  451. DECLARE @Test sysname,
  452.         @MaxLength INT,
  453.         @CurrentLength INT;
  454.  
  455. DECLARE tests CURSOR STATIC LOCAL READ_ONLY FORWARD_ONLY
  456. FOR SELECT  [String]
  457.     FROM        #Substrings
  458.     ORDER BY    LEN([String]) DESC;--, [SubstringsID] ASC -- ??
  459.  
  460. OPEN tests;
  461.  
  462. FETCH   NEXT
  463. FROM        tests
  464. INTO        @Test;
  465.  
  466. WHILE (@@FETCH_STATUS = 0)
  467. BEGIN
  468.     SET @CurrentLength = LEN(@Test);
  469.     RAISERROR(N'Testing substring: %s', 0, 0, @Test) WITH NOWAIT;
  470.  
  471.     -- @MaxLength will remain NULL until the first common substring is found
  472.     IF ((@ReturnAllSubstrings = 0) AND (@CurrentLength < @MaxLength))
  473.     BEGIN
  474.         BREAK;
  475.     END;
  476.  
  477.     IF (NOT EXISTS(
  478.             SELECT  *
  479.             FROM        #MultipleMatches mm
  480.             WHERE   CHARINDEX(@Test, mm.[String]) = 0
  481.             )
  482.         )
  483.     BEGIN
  484.         SET @MaxLength = ISNULL(@MaxLength, @CurrentLength);
  485.  
  486.         INSERT INTO @Matches ([String], [IsLongest])
  487.         VALUES (@Test, IIF(@CurrentLength = @MaxLength, 1, 0));
  488.  
  489.         RAISERROR(N'Found match: %s; Length: %d', 0, 0, @Test, @CurrentLength) WITH NOWAIT;
  490.     END;
  491.  
  492.     FETCH   NEXT
  493.     FROM        tests
  494.     INTO        @Test;
  495. END;
  496.  
  497. CLOSE tests;
  498. DEALLOCATE tests;
  499.  
  500. /* Display the results */
  501. SELECT  [String], [IsLongest]
  502. FROM        @Matches;
  503. -- 0:22 across several executions IF @ReturnAllSubstrings = 0
  504. -- 2:41 across several executions IF @ReturnAllSubstrings = 1
  505. /*
  506. String  IsLongest
  507. 1234567 1
  508. referen 1
  509. 123456  0
  510. 234567  0
  511. eferen  0
  512. refere  0
  513. 12345   0
  514. 23456   0
  515. 34567   0
  516. efere   0
  517. feren   0
  518. refer   0
  519. _Yo!        0
  520. 1234        0
  521. 2345        0
  522. 3456        0
  523. 4567        0
  524. efer        0
  525. eren        0
  526. fere        0
  527. refe        0
  528. _Yo     0
  529. 123     0
  530. 234     0
  531. 345     0
  532. 456     0
  533. 567     0
  534. efe     0
  535. ere     0
  536. fer     0
  537. ref     0
  538. ren     0
  539. Yo!     0
  540. _Y      0
  541. 12      0
  542. 23      0
  543. 34      0
  544. 45      0
  545. 56      0
  546. 67      0
  547. ef      0
  548. en      0
  549. er      0
  550. fe      0
  551. o!      0
  552. re      0
  553. Yo      0
  554. !       0
  555. _       0
  556. 1       0
  557. 2       0
  558. 3       0
  559. 4       0
  560. 5       0
  561. 6       0
  562. 7       0
  563. c       0
  564. e       0
  565. f       0
  566. n       0
  567. o       0
  568. r       0
  569. Y       0
  570. */
  571.  
  572.  
  573.  
  574.  
  575.  
  576. -------------------------------------------------------------------------------------
  577.  
  578. /* -- related research queries:
  579.  
  580. SELECT MAX(LEN([String])) FROM #ShortStrings;
  581. SELECT DISTINCT [String] FROM #ShortStrings;
  582.  
  583. SELECT * FROM sys.assemblies;
  584. SELECT * FROM sys.dm_clr_loaded_assemblies;
  585.  
  586. SELECT CONVERT(BIT, 'True');
  587. SELECT '1234567' + CONVERT(VARCHAR(5), CRYPT_GEN_RANDOM(3)) + '_Yo!'
  588.  
  589. */
RAW Paste Data