-- oracle
select
chr(trunc(dbms_random.value(97, 122), 0)) ,
chr(trunc(dbms_random.value(97, 122), 0)) ,
chr(trunc(dbms_random.value(33, 90), 0)) ,
chr(trunc(dbms_random.value(33, 47), 0)) ,
chr(trunc(dbms_random.value(48, 57), 0)) ,
chr(trunc(dbms_random.value(33, 90), 0))
from ANY_TABLE
-- mssql
select
lower(char(cast(round((122-97)*rand()+97, 0) as integer))) + '' +
lower(char(cast(round((122-97)*rand()+97, 0) as integer))) + '' +
lower(char(cast(round((90-33)*rand()+33, 0) as integer))) + '' +
lower(char(cast(round((47-33)*rand()+33, 0) as integer))) + '' +
lower(char(cast(round((57-48)*rand()+48, 0) as integer))) + '' +
lower(char(cast(round((90-33)*rand()+33, 0) as integer)))
출처 : http://www.sqler.com/bColumn/884951