DECLARE @Name VarChar(MAX)
DECLARE @StringToReplace VarChar(MAX)
DECLARE @NewString VarChar(MAX)
SET @StringToReplace = SPACE(1)
SET @NewString = ','
SET @Name = 'MARIJUN P. MASCARINASO'
SET @Name = 'MA. BEVELYN D DABILAU'
SET @Name = 'SHEERWINE JOEL QUARTIRU'
SELECT
[Name] = @Name
,[First Instance of space] = STUFF(@Name, CHARINDEX(@StringToReplace, @Name), LEN(@StringToReplace), @NewString)
,[Last Instance of space] = STUFF(@Name, LEN(@Name) - CHARINDEX(@StringToReplace, REVERSE(@Name)) + 1, LEN(@StringToReplace), @NewString)
DECLARE @StringToReplace VarChar(MAX)
DECLARE @NewString VarChar(MAX)
SET @StringToReplace = SPACE(1)
SET @NewString = ','
SET @Name = 'MARIJUN P. MASCARINASO'
SET @Name = 'MA. BEVELYN D DABILAU'
SET @Name = 'SHEERWINE JOEL QUARTIRU'
SELECT
[Name] = @Name
,[First Instance of space] = STUFF(@Name, CHARINDEX(@StringToReplace, @Name), LEN(@StringToReplace), @NewString)
,[Last Instance of space] = STUFF(@Name, LEN(@Name) - CHARINDEX(@StringToReplace, REVERSE(@Name)) + 1, LEN(@StringToReplace), @NewString)
Comments
Post a Comment