We have a table with just one fieldname called Names.
There are several rows of long values associated with this fieldname.
Below is an example of how long each row of values could be.
Names
0000000024DOE JAMES JAN E102/02/1988107/11/2007 13011UNASSIGNED EMPLOYEEID 0175420670 3303302 - DY1 B100 1000 - 07/11/2007 0000028800 0000040849 0000173045 0000021600
etc
etc
Is it possible to just extract only the names from the lists similar to above?
For instance, we would like to extract DOE JAN while ignoring the rest of the values.
Sometimes, the names have a middle initial.
Example:
0000000024DOE JAMES JAN E102/02/1988107/11/2007 13011UNASSIGNED EMPLOYEEID 0175420670 3303302 - DY1 B100 1000 - 07/11/2007 0000028800 0000040849 0000173045 0000021600
In this example, the value we would like to extract is Doe Jan E.
Any ideas how to go about it if it is possible?
Assuming the name starts at position 11 and it terminated with 3 numbers and a slash, the following should do it for you.
PATINDEX returns the location based on a wildcard pattern.