时间:2021-07-01 10:21:17 帮助过:24人阅读
WITH前加分号是一种保险的写法,否则可能遇到消息336的语法问题。
DECLARE @choice INT ;WITH cte AS (SELECT ROW_NUMBER() OVER(ORDER BY Num) AS RowNo,Num FROM (VALUES (88) ,(118) ,(138) ,(188) ) AS a(Num)) SELECT @choice=Num FROM cte WHERE RowNo=CEILING((SELECT COUNT(1) FROM cte)*RAND())
求更好写法,感谢。
-EOF-
【SQL】从待选项中随机选一个
标签:server 需求 and where rom ice div eof sel