Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add records from one table to another
Message
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01652499
Message ID:
01652512
Views:
37
>>>>>Yes, there are CHARINDEX and SUBSTRING functions in SQL Server. In SQL Server 2016 (I think) they also finally introduced the split function.
>>>>
>>>>Thank you.
>>>
>>>You're welcome. Play with the select statements first until you get it parsed correctly.
>>>
>>>This blog post may help
>>>
>>>http://blogs.lessthandot.com/index.php/datamgmt/datadesign/parsing-fullname-field-to-individual/
>>
>>Thank you. I found this example online and trying to make it work for me:
>>
>>
>>DECLARE @FullName    VARCHAR(50) = 'Mark Zuckerberg'
>>
>>SELECT SUBSTRING(@FullName, 1, CHARINDEX(' ', @FullName) - 1) AS [First Name],
>>       SUBSTRING(@FullName, CHARINDEX(' ', @FullName) + 1, LEN(@FullName)) AS [Last Name]
>>
>
>Make sure all odd cases are handled as well (e.g. if you don't have ',' in the name, if you have something extra, NULL, etc.)
>

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform