I have a table with a whole name. I have a function that receives said name, parses it, and returns a table with first, middle, last, and suffix. I have a bad
(edit: was "hyper-conservative") DBA who won't upgrade the dev server to the same version as the production one so I can't just use APPLY and be done with it:
insert into blah (name, firstName, middleName, lastName, suffix)
select a.name, b.firstName, b.middleName, b.lastName, b.suffix
from employees a CROSS APPLY dbo.parseName(a.name) b
Please help, or I will be forced to write code like this:
insert into blah (name, firstName, middleName, lastName, suffix)
select
name, dbo.getNamePart(name, 'f') as firstName,
dbo.getNamePart(name, 'm') as middleName,
dbo.getNamePart(name, 'l') as lastName,
dbo.getNamePart(name, 's') as suffix
from employees r