Split FirstName Middle Initial column using derived column SSIS

I have a column entitled FirstMiddleName that I need to seperate out.  I am having trouble with the Derived function for the middle name

Example

John William

It's that simple, space separated.  I dont' care much about Names that are supposed to be together (like Mary Ann)  I just need them seperated out so I can run a gender match on the name column.

Thanks,
gwarcherAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee SavidgeCommented:
How are you planning on gender matching on the name?

declare @x nvarchar(100), @f nvarchar(100), @l nvarchar(100)

select @x = 'John Williams'


select @f = rtrim(left(@x, charindex(' ', @x))), @l = ltrim(replace(@x, @f, ''))

select @f as firstname, @l as lastname, @x as fullname

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gwarcherAuthor Commented:
I have a separate table that I run an update with.  Do you know how to do it with Derived columns?  I'm trying to accomplish this during import.
0
Lee SavidgeCommented:
Is this a one off import?
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Lee SavidgeCommented:
Oh I see, you wanted this in the import ssis package. I just saw the MS SQL Server zone. Sorry I'm not particularly familiar with them. I tend to do a raw import into SQL and then use a stored procedure to process it once inside the DB. Loads easier... assuming you're a confident SQL coder.
0
gwarcherAuthor Commented:
I'm okay.  I have a mass file that I have to update quarterly and the most time efficient way to do it is through SSIS.  I think I found something though.  Thanks for the help!
0
gwarcherAuthor Commented:
I fixed it using a sql statement in the SSIS like you said, not going to bother with Derived columsn.
0
Lee SavidgeCommented:
Glad to have helped. Sometimes it just needs another set of eyes :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.