This script will create a database called 'The1000' and 1001 tables named T1, T2, T3, ... T1000 containing 1000 identical records each, plus a table called 'track' - the contents of that should be around 2092 rows.
use master
IF EXISTS(select * from sys.databases where name='The1000')
DROP DATABASE The1000
GO
CREATE DATABASE The1000
GO
use The1000
CREATE TABLE track (id int identity(1,1), dat nvarchar(255))
GO
SET NOCOUNT ON;
DECLARE @maxlength int = 30
DECLARE @minlength int = 2
INSERT INTO track
SELECT
(
select top (abs(checksum(newid())) % (@maxlength-@minlength) + @minlength) char(abs(checksum(newid())) % 26 + ascii('A'))
from sys.all_objects a1
where sign(a1.object_id) = sign(t.object_id)
for xml path('')
) as NewRandomString
FROM sys.all_objects t;
DECLARE @start int = 1
DECLARE @end int = 1000
WHILE @start <= @end
BEGIN
declare @sql nvarchar(max) = 'CREATE TABLE T' + CAST(@start AS NVARCHAR)
set @sql += '( ID INT, DAT NVARCHAR(255)) '
set @sql += 'INSERT INTO T' + CAST(@start AS NVARCHAR) + ' SELECT TOP 1000 * FROM track'
EXEC sp_executeSql @sql
SET @start += 1
END
If you want random table names then use the
dat
column from the table
track
where
id = @start
instead.