Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Feb 22nd, 2018 69 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. create table table1
  2. (
  3.     NAME varchar(60),
  4.     SeriesID varchar(160)
  5. )
  6.  
  7. Insert into table1
  8. values ('A1', '398,412,411'),
  9.        ('A2', '123,516,203')
  10.    
  11. SELECT NAME, SeriesID
  12. FROM TABLE1
  13. WHERE SeriesID LIKE '%' + (Subquery) + '%'
  14.    
  15. DECLARE @table1 TABLE
  16.     (
  17.       NAME VARCHAR(60) ,
  18.       SeriesID VARCHAR(160)
  19.     )
  20.  
  21. INSERT  INTO @table1
  22. VALUES  ( 'A1', '398,412,411' ),
  23.         ( 'A2', '123,516,203' ),
  24.         ( 'A3', '322,123,324' )
  25.  
  26. DECLARE @table2 TABLE ( ID VARCHAR(50) )
  27.  
  28. INSERT  INTO @table2
  29. VALUES  ( '398' ) ,
  30.         ( '322' )
  31.  
  32. SELECT DISTINCT
  33.         *
  34. FROM    @table1
  35. WHERE   EXISTS ( SELECT 1
  36.                  FROM   @table2
  37.                  WHERE  SeriesID LIKE '%' + ID + '%' )
  38.    
  39. DECLARE @table1 TABLE
  40.     (
  41.       NAME VARCHAR(60) ,
  42.       SeriesID VARCHAR(160)
  43.     )
  44.  
  45. INSERT  INTO @table1
  46. VALUES  ( 'A1', '398,412,411' ),
  47.         ( 'A2', '123,516,203' ),
  48.         ( 'A3', '322,123,324' )
  49.  
  50. DECLARE @table2 TABLE ( ID VARCHAR(50) )
  51.  
  52. INSERT  INTO @table2
  53. VALUES  ( '398|322' )
  54.  
  55. DECLARE @sqlnet SQLNET = SQLNET::New('Regex.IsMatch(input, pattern)')
  56. SELECT DISTINCT
  57.         *
  58. FROM    @table1
  59. WHERE   EXISTS ( SELECT 1
  60.                  FROM   @table2
  61.                  WHERE  @sqlnet.Val('input', SeriesID).Val('pattern', ID).EvalBit() = 1 )
  62.    
  63. SELECT NAME, SeriesID
  64. FROM TABLE1
  65. WHERE ',' + SeriesID + ',' LIKE '%,' + (Subquery) + '%'
  66.    
  67. SELECT * FROM table WHERE field REGEXP '1740|1938|1940';
  68.    
  69. (select group_concat(myColumn separator '|') from..)
  70.    
  71. declare @query  nvarchar(max) = 'SELECT NAME,SeriesID FROM TABLE1 WHERE SeriesID in (' + @Subquery + ')'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top