Guest User

Untitled

a guest
Jul 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. Msg 117, Level 15, State 1, Line 1
  2. The object name 'eih-dr01.eih.ehs.org.DBA.dbo.fp_monthly' contains more than the maximum number of prefixes. The maximum is 2.
  3.  
  4. declare @table varchar(255),
  5. @sql nvarchar(max)
  6.  
  7. declare c cursor local for
  8.  
  9.  
  10. select st.name from sys.tables st
  11.  
  12. open c
  13.  
  14. fetch next from c into @table
  15.  
  16. set @sql = 'select * into [eih-dr01.eih.ehs.org].DBA.dbo.' + @table + ' from ' + @table
  17.  
  18. print @sql
  19. exec sp_executesql @sql
  20.  
  21. fetch next from c into @table
  22.  
  23. close c
  24. deallocate c
Add Comment
Please, Sign In to add comment