Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bruuteuzius/f6e7985adddf5394f3ed9758dc81b1e0 to your computer and use it in GitHub Desktop.
Save bruuteuzius/f6e7985adddf5394f3ed9758dc81b1e0 to your computer and use it in GitHub Desktop.
declare @naam nvarchar(200) = 'Testnaam, J.M.S. van de'
select
fullname = @naam
,initials = substring(SUBSTRING(@naam, patindex('%, %', @naam)+1, len(@naam)), 0,patindex('%. %', SUBSTRING(@naam, patindex('%, %', @naam), len(@naam))))
,middlename = ltrim(substring(SUBSTRING(@naam, patindex('%, %', @naam)+1, len(@naam)), patindex('%. %', SUBSTRING(@naam, patindex('%, %', @naam), len(@naam))), len(SUBSTRING(@naam, patindex('%, %', @naam)+1, len(@naam)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment