xxxxxxxxxx
-- INIT database
CREATE TABLE Usertbl (
ID INT IDENTITY(1, 1),
Name VARCHAR(100)
);
INSERT INTO Usertbl(Name) VALUES ('Andrey Smith');
-- QUERY database
SELECT ID, (
SELECT STRING_AGG(LEFT(CONVERT(VARCHAR(255), NEWID()), CHARINDEX('-', CONVERT(VARCHAR(255), NEWID())) - 1),' ')
FROM STRING_SPLIT(Name, ' ')
)
AS NewName
FROM Usertbl
ID | NewName |
---|---|
1 | BA81E0A5 D92AFBB8 |
(1 rows affected)