19 April 2014

Generate Sequence number with Prefix in sql server



DECLARE @intFlag INT
SET @intFlag = 1
WHILE (@intFlag <=10)
BEGIN
print 'B'+RIGHT('00000'+ CONVERT(VARCHAR,@intFlag),6)
SET @intFlag = @intFlag + 1
END
GO

OUTPUT



No comments:

Post a Comment