sqlserver函数编写
select REPLACE (NEWID() ,'-','') +
replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','') +
CHAR(ROUND(RAND() * 25 + 65,0))
生成一串 随机字符串
想应用于
create table MedicalService
(
id varchar(50) primary key default REPLACE (NEWID() ,'-','') +
replace(replace(replace(CONVERT(varchar, getdate(), 120 ),'-',''),' ',''),':','') +
CHAR(ROUND(RAND() * 25 + 65,0))
)
生成表格用 。但是太长了 如何封装成类似函数的东西 累死于 default getdate() 。。函数不支持 rand
------解决方案--------------------