View difference between Paste ID: 304pHef5 and 3xHYDQNL
SHOW: | | - or go back to the newest paste.
1
declare cur_tables cursor local static for
2
	select * from
3
	openquery(MYSQL, 'show tables')
4
declare @table nvarchar(max)
5
	
6
open cur_tables
7
fetch next from cur_tables into @table
8
WHILE @@FETCH_STATUS = 0
9
begin
10
	print 'processing ' + @table
11
	exec ('drop table oldchleby.dbo.[' + @table + ']')
12-
	exec ('drop table [oldchleby.dbo.' + @table + ']')
12+
	exec ('select * into oldchleby.dbo.[' + @table + ']' +
13-
	exec ('select * into [oldchleby.dbo.' + @table + ']' +
13+
14
	fetch next from cur_tables into @table
15
end
16
17
close cur_tables