Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. DECLARE @item VARCHAR(50)
  2. SET @ExpressionToSearch = '23,12'
  3.  
  4. SET @item = '23'
  5. SELECT COUNT(*) from dbo.Split(@ExpressionToSearch,',')
  6. WHERE ',' + (@ExpressionToSearch) + ','
  7. LIKE '%'+@item +'%'
  8.  
  9. select count(*) FROM table where id = '5';
  10.  
  11. Declare @MyString varchar(50)
  12. Set @MyString = '1,2,3,4,5'
  13. IF CHARINDEX('5',ContactName) > 0
  14. Begin
  15. Print '5 Exists'
  16. End
  17. Else
  18. Begin
  19. Print '5 Does not exists'
  20. End
  21.  
  22. SELECT column FROM table WHERE CHARINDEX(',5,',(',' + column + ',')) > 0
  23.  
  24. ',1,2,3,4,5,'
  25.  
  26. ',5,'
  27.  
  28. SELECT column FROM table WHERE column like '%,5,%';
  29.  
  30. SELECT column FROM table WHERE CHARINDEX(',5,',(',' + column + ',')) > 0
  31.  
  32. ',5,50,150,250,350,450,500,'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement