код короче и без тире
SELECT LEFT(REPLACE(CONVERT(varchar(255), NEWID()),'-',''),20)
SELECT dbo.IntToAlpha( 1136572 )
cmrii
CREATE OR ALTER FUNCTION dbo.IntToAlpha ( @IN INT ) RETURNS VARCHAR(16)
WITH EXECUTE AS CALLER
AS
BEGIN
DECLARE @ST VARCHAR(16) = ''
WHILE @IN > 0 BEGIN
SET @ST = CHAR((@IN % 26) + 97 ) + @ST
SET @IN = @IN / 26
END
RETURN @ST
END
--
GO