m******u 发帖数: 12400 | 1 这第二题。
我用cast(rand(datepart(millisecond, getdate())) as integer)
会出现许多同号的,而且,随机性并不好。比如我连续执行,出现的都是71,72,73什么
的,就是说,在一个很短的时间段内执行,结果也集中在某个值附近。
E.8.1
Create a batch that inserts 3000 rows in the employee table. The values of
the emp_no
column should be unique and between 1 and 3000. All values of the columns
emp_
lname, emp_fname, and dept_no should be set to 'Jane', ' Smith', and ' d1',
respectively.
E.8.2
Modify the batch E.8.1 so that the values of the emp_no column should be
generated
randomly using the RAND function. (Hint: Use the temporal system functions
DATEPART and GETDATE to generate the random values.) | c*****d 发帖数: 6045 | 2 你run SELECT rand(1), RAND(2), RAND(3)就知道为什么了 |
|