Monday, November 11, 2013

using random in sql for unique values

create table #tempo (id int unique identity, val varchar(100)  unique, other  varchar(1000))
insert into #tempo(val,other  )
select cast (cast(RAND() * 100000000 as int ) as varchar)    ,'fdgfggdfdfgdg'
union select cast(cast( RAND()* 100000000 as int) as varchar)   ,'fdfgdfdfgdg'
select * from #tempo
drop table #tempo

No comments:

Post a Comment