Answer the question
In order to leave comments, you need to log in
How to fill a table with two columns with arbitrary data?
Good afternoon.
Prompt how to fill the table with the test data in MS SQL. In one table, numbers from 1 to 15 must be repeated 20 to 30 times. In another arbitrary date in the range of 2008 to 2016. Can this be done or is it fiction?
Answer the question
In order to leave comments, you need to log in
SELECT a.ID,
DATEADD( s, RAND( CONVERT( INT, CAST( NEWID() AS BINARY(16) ), 1)) * 252460800, '20080101' ) AS dt
FROM
(VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12), (13), (14), (15)) AS A (ID)
CROSS JOIN
(VALUES (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)) AS B(C)
ORDER BY NEWID()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question