declare @string varchar(10)
declare @string2 varchar(10)
declare @choices varchar(100)
declare @count int
SET @choices = ''
-- load up numbers 0 - 9
SET @count = 48
while @count <=57
begin
SET @choices = @choices + Cast(CHAR(@count) AS char(1))
SET @count = @count + 1
end
-- load up uppercase letters A - Z
SET @count = 65
while @count <=90
begin
SET @choices = @choices + Cast(CHAR(@count) AS char(1))
SET @count = @count + 1
end
-- load up lowercase letters a - z
SET @count = 97
while @count <=122
begin
SET @choices = @choices + Cast(CHAR(@count) AS char(1))
SET @count = @count + 1
end
declare @whatever varchar(100)
SET @whatever = 'JackAndJillWentUpTheHillToFetchAPailOfH20'
SET @whatever = @whatever + 'PittsburghWinsTheSuperBowl'
SET @count = 0
SET @string = ''
SET @string2 = ''
while @count <= 10
begin
SET @string = @string + SUBSTRING(@choices,CAST(ABS(CHECKSUM(NEWID()))*RAND(@count) AS int)%LEN(@choices)+1,1)
SET @string2 = @string2 + SUBSTRING(@whatever,CAST(ABS(CHECKSUM(NEWID()))*RAND(@count) AS int)%LEN(@whatever)+1,1)
SET @count = @count + 1
end
print @string
print @string2