Friday, October 5, 2012

use CHARINDEX in MSSQL to try to find a substring within a string

SELECT Email,
CASE WHEN CHARINDEX('(',FirstName) > 0
THEN FirstName
ELSE (FirstName + ' ' + LastName) END AS Username
FROM Person

No comments:

Post a Comment