Here's a quick and easy way to generate fake social security numbers, which is very useful for sample data.
create table #ssns
(
ssn varchar(11)
)
go
declare @cnt int
DECLARE @maxRandomValueA int = 999, @minRandomValue int = 0;
DECLARE @maxRandomValueB int = 99
DECLARE @maxRandomValueC int = 9999
Set @cnt = 1
While @cnt <= 587 Begin
Insert Into #ssns(ssn)
select
replicate('0',
3-len(gen.a))+gen.a+'-'+
replicate('0', 2-len(gen.b))+gen.b+'-'+
replicate('0', 4-len(gen.c))+gen.c
from
(
SELECT
convert(varchar(3),CAST(((@maxRandomValueA + 1) - @minRandomValue) * RAND() + @minRandomValue AS int)) as a,
convert(varchar(2),CAST(((@maxRandomValueB + 1) - @minRandomValue) * RAND() + @minRandomValue AS int)) as b,
convert(varchar(4),CAST(((@maxRandomValueC + 1) - @minRandomValue) * RAND() + @minRandomValue AS int)) as c
) gen
Set @cnt = @cnt + 1
End
select * from #ssns