Select Rand() as 随机数,* Into Cursor 临时表 From 表1 Where 字段名=1 Order By 1
上述命令,老师想得真是妙!
老师就是老师,我这个学生望尘莫及啊.
继续问:加一个条件:
只取20条记录:
Select Rand() as 随机数,* Into Cursor 临时表 From 表1 Where 字段名=1 and 只取表1的20条记录 Order By 1
------解决方案--------------------------------------------------------
Select top 20 Rand() as 随机数,* Into Cursor 临时表 From 表1 Where 字段名=1 Order By 1
or
select top 20 * from (
Select Rand() as 随机数,* Into Cursor 临时表 From 表1 Where 字段名=1 Order By 1) a