Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Msg 117, Level 15, State 1, Line 1
- The object name 'eih-dr01.eih.ehs.org.DBA.dbo.fp_monthly' contains more than the maximum number of prefixes. The maximum is 2.
- declare @table varchar(255),
- @sql nvarchar(max)
- declare c cursor local for
- select st.name from sys.tables st
- open c
- fetch next from c into @table
- set @sql = 'select * into [eih-dr01.eih.ehs.org].DBA.dbo.' + @table + ' from ' + @table
- print @sql
- exec sp_executesql @sql
- fetch next from c into @table
- close c
- deallocate c
Add Comment
Please, Sign In to add comment