Monday, October 22, 2012

SQL - Check if Char Exists




DECLARE @somestring as nvarchar(50) = 'test,value';


select
[test] = CASE
  WHEN CHARINDEX(',', @somestring) > 0
    THEN 'exists'
    ELSE 'does not exist'
  END

No comments:

Post a Comment