Click here to Skip to main content
15,902,718 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a table called numbers test. the structure of the table is as given below.

VB
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?
Posted

1 solution

Try this:
SQL
INSERT INTO newTable SELECT * FROM numbersTest ORDER BY NEWID()


[EDIT]

You can also try this:
SQL
INSERT INTO newTable (Number) SELECT Number FROM numbersTest ORDER BY NEWID()
 
Share this answer
 
v4
Comments
ARUN K P 28-Aug-13 2:42am    
But i have only one column. i haven't created primary key id for tat table.
Thomas Daniels 28-Aug-13 2:44am    
I updated my answer.
ARUN K P 28-Aug-13 2:47am    
ok thanks.
Thomas Daniels 28-Aug-13 2:49am    
You're welcome!
ARUN K P 28-Aug-13 2:55am    
i m getting errors. is there any other way?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900