Advertisement
hejmus

Untitled

Mar 2nd, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 ('select * into oldchleby.dbo.[' + @table + ']' +
  13.           ' from openquery(MYSQL,''select * from `' + @table + '`'')')
  14.     fetch next from cur_tables into @table
  15. end
  16.  
  17. close cur_tables
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement