随机数从1到10,000 [英] Random Numbers from 1 to 10,000

查看:166
本文介绍了随机数从1到10,000的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个叫做数字测试的表。表的结构如下所示。



数字
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100


10 000



现在我想将这些数字复制到另一个表中。但是数字应该随机插入,比如



2

998

34

...

喜欢tat。但它应包含上表中包含的所有值。我怎么能这样做?

解决方案

试试这个:

  INSERT   INTO  newTable  SELECT  *  FROM  numbersTest  ORDER   BY  NEWID()









你也可以试试这个:

  INSERT   INTO  newTable(Number) SELECT  Number  FROM  numbersTest  ORDER   BY  NEWID( )


I have a table called numbers test. the structure of the table is as given below.

Number
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
.
.
10,000


now i want to copy these numbers into another table . but there the numbers should be inserted randomly like

2
998
34
...
like tat . but it should contain all the values which is contained in the previous table. how can i do this?

解决方案

Try this:

INSERT INTO newTable SELECT * FROM numbersTest ORDER BY NEWID()



[EDIT]

You can also try this:

INSERT INTO newTable (Number) SELECT Number FROM numbersTest ORDER BY NEWID()


这篇关于随机数从1到10,000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆