Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
CREATE TABLE #Names (ID INT identity not null,NameField VARCHAR(50), ProperNameField VARCHAR(50))
INSERT INTO #Names
SELECT 'Klein, Barbara',NULL
UNION ALL
SELECT 'Smith, John',NULL
UNION ALL
SELECT 'Jackson, Michael',NULL
UNION ALL
SELECT 'Gates, Bill',NULL
Barbara Klein
John Smith
Michael Jackson
Bill Gates
Select Substring(NameField,Charindex(' ',Namefield)+1,50)+' '+Substring(NameField,1,Charindex(',',Namefield)-1)
from #Names
UPDATE #Names SET ProperNameField = NameField, NameField =
(LTRIM(SUBSTRING(NameField,CHARINDEX(',',NameField,1)+ 1,20))) + ' ' +
(RTRIM(SUBSTRING(NameField,0,CHARINDEX(',',NameField,1))))
Invalid length parameter passed to the substring function.
The statement has been terminated.
Update #names
SET ProperNameField= Substring(NameField,Charindex(' ',Namefield)+1,20)
+' '+
Substring(NameField,0,Charindex(',',Namefield))