'SPLR' + RIGHT('00000' + CAST(Id AS NVARCHAR(10)),6)
CREATE TABLE #SampleTable ( ID INT Identity(1,1), Column1 VARCHAR(50) ) INSERT INTO #SampleTable SELECT 'Row 1' UNION SELECT 'Row 2' SELECT *, 'SPLR' + REPLICATE('0', 6 - LEN(ID)) + CAST(ID AS VARCHAR) FROM #SampleTable DROP TABLE #SampleTable
DECLARE @ID INT = CAST(SUBSTRING('SPLR000001',5,10) AS INT) SET @ID = @ID + 1 SELECT 'SPLR' + RIGHT(Replicate('0',6) + CAST(@ID AS VARCHAR),6)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)