Hi All,
I am wondering if there is a way to return CHARINDEX reading from right to left. Here is my problem, I have to take last names from a name field where field can be populated in any of these ways:
J. J. Doe
J. Doe
John Doe
John J. Doe
And I haven't come across a J. John Doe but it would not surprise me if I did.
What I want to return is the Last name, or everything past the Right most space in a column. Is there any way I can tell SQL to do this, or am I going to have to do it the ugly way? I have not yet completely conceived the ugly way yet, but I know it will come to me on the drive home.
A million thanks to anyone who can help me avoid taking it that far, as this name is going to be used to match back to three other tables and the ugly way seems like it could lead to an exceptionally long query. Thanks in advance for your time on this one.
Alex
It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
I am wondering if there is a way to return CHARINDEX reading from right to left. Here is my problem, I have to take last names from a name field where field can be populated in any of these ways:
J. J. Doe
J. Doe
John Doe
John J. Doe
And I haven't come across a J. John Doe but it would not surprise me if I did.
What I want to return is the Last name, or everything past the Right most space in a column. Is there any way I can tell SQL to do this, or am I going to have to do it the ugly way? I have not yet completely conceived the ugly way yet, but I know it will come to me on the drive home.
A million thanks to anyone who can help me avoid taking it that far, as this name is going to be used to match back to three other tables and the ugly way seems like it could lead to an exceptionally long query. Thanks in advance for your time on this one.
Alex
It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.