October 30, 2017 at 2:59 pm
Alan.B - Monday, October 30, 2017 2:02 PMAnother way, using Luis' sample data
SELECT name, rtrim(ltrim(isnull(parsename(' '+x.name+' ', 2), x.name))) as name2
FROM (VALUES('Luis.Cazares'),('Luis Cazares'),('Luis Cazares.'),('.Luis Cazares')) x(name);
Again, I strongly recommend that concatenation be avoided for such things. See my previous response to Luis.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 30, 2017 at 3:34 pm
Jeff Moden - Monday, October 30, 2017 2:59 PMAlan.B - Monday, October 30, 2017 2:02 PMAnother way, using Luis' sample data
SELECT name, rtrim(ltrim(isnull(parsename(' '+x.name+' ', 2), x.name))) as name2
FROM (VALUES('Luis.Cazares'),('Luis Cazares'),('Luis Cazares.'),('.Luis Cazares')) x(name);Again, I strongly recommend that concatenation be avoided for such things. See my previous response to Luis.
I missed that. Agreed.
-- Itzik Ben-Gan 2001
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply