WebAug 8, 2024 · I have a field with the first and last name separated by a space, ex. John Cena I want to get the first and last initials ex. JC Please tell me how I can achieve that. · Hi Saanah, Please try the following: -- DDL and data population, start DECLARE @tbl TABLE (ID INT IDENTITY(1,1) PRIMARY KEY, CombinedName VARCHAR(100)); INSERT … WebHow the query works. First, use the CONCAT function to construct the full name of the employee by concatenating the first name, space, and last name.; Second, apply the LENGTH function to return the number of characters of the full name of each employee.; Third, sort the result set by the result of the LENGTH function and get five rows from …
“How to get the full names,first name and lastname of …
WebMay 22, 2014 · -- Code for parsing first name followed by last name DECLARE @nameString as varchar(128) SET @nameString = 'Jerome Sardo' -- find the delimiter for the end of the first name SELECT CHARINDEX(' ',@namestring,1) space_location -- extract the first name SELECT SUBSTRING(@nameString,1,CHARINDEX(' … WebAug 8, 2024 · create table #temp (name varchar(200)) insert #temp values ('John … bruce lee bearbrick
Name Parsing with SQL Server Functions and T-SQL …
WebI have a list of names, such as: Doe John James, Doe Jane and Doe Henry Albert Sr. I need to split those out into the four component parts of the name (if the name has four parts) to put each of them in their own column (last name, first name, middle name, suffix), while allowing for names that may or may not have a middle name or suffix. WebFeb 10, 2010 · Feb 10th, 2010 at 2:19 AM. Hi, You will have to pick the user id from the … WebMar 6, 2009 · One more question for the week, if possible quick response from you guys … evs display