SHARE
TWEET

Detect Middle Spaces

SQLSoldier Aug 29th, 2016 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Declare @T Table (Test varchar(100));
  2.  
  3. Insert Into @T
  4. Values ('me@me.com; test@email.com'),
  5.     ('me@me.com;  test@email.com');
  6.  
  7. Select Test
  8. From @T
  9. Where SubString(Test, CharIndex('; ', Test) + 1, CharIndex(' test@email.com', Test,  CharIndex('; ', Test)) - CharIndex('; ', Test)) Not Like '^[ ]';
RAW Paste Data
Top