--自己补充C到Y select 两位随机字母 = (select top 1 id from (select 'A' as id union select 'B' union select 'Z') m order by newid()) + (select top 1 id from (select 'A' as id union select 'B' union select 'Z') n order by newid())/* 两位随机字母 ------ BA(1 行受影响) */
--自己补充F到Y select 两位随机字母 = (select top 1 id from (select 'A' as id union select 'B' union select 'C' union select 'D' union select 'E' union select 'Z') m order by newid()) + (select top 1 id from (select 'A' as id union select 'B' union select 'C' union select 'D' union select 'E' union select 'Z') n order by newid())/* 两位随机字母 ------ BA(1 行受影响)两位随机字母 ------ ED(1 行受影响)两位随机字母 ------ CB(1 行受影响)....... */
select 两位随机字母 =
(select top 1 id from (select 'A' as id union select 'B' union select 'Z') m order by newid())
+
(select top 1 id from (select 'A' as id union select 'B' union select 'Z') n order by newid())/*
两位随机字母
------
BA(1 行受影响)
*/
select 两位随机字母 =
(select top 1 id from (select 'A' as id union select 'B' union select 'C' union select 'D' union select 'E' union select 'Z') m order by newid())
+
(select top 1 id from (select 'A' as id union select 'B' union select 'C' union select 'D' union select 'E' union select 'Z') n order by newid())/*
两位随机字母
------
BA(1 行受影响)两位随机字母
------
ED(1 行受影响)两位随机字母
------
CB(1 行受影响).......
*/
rand返回0-1之间随机的float.
即返回结果为0,0.xxx,1范围为0-1的之间的float数。那么 * 25就得到 0 到 25之间的数。0-25之间的数 + 97 就得到 97-122之间的数。26个英文字母, a的ascii码是97
你要产生的大写的话,写 + 65 就可以了。