使用sql生成UUID
在SQLServer中使用该sql语句可以生成GUID:select cast(NEWID() as varchar(36)) as uuid
通过一下语句将GUID中的'-'字符去掉:
select SUBSTRING(uuid,1,8)+SUBSTRING(uuid,10,4)+SUBSTRING(uuid,15,4)+
SUBSTRING(uuid,20,4)+SUBSTRING(uuid,25,12) from (select cast(NEWID() as varchar(36)) as uuid ) s
在oracle中使用select sys_guid() from dual;可以获得guid。