Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 use view to insert?

Author  Topic 

qwertyjjj
Posting Yak Master

131 Posts

Posted - 2007-07-17 : 06:17:16
I have a view that selects certain data.
I wish to insert the data into another table on a different server.
I'm happy to just use the SQL directly in a stored procedure but if someone changes the view then I would like to use the updated SQL.

Can this be done with a view or is it a case of updating 2 separate SQL statements every time a change is needed?

nr
SQLTeam MVY

12543 Posts

Posted - 2007-07-17 : 07:57:26
As long as the structure is the same then you only have to change the view.
Just select from it from the remote server.

I would use a stored proc, insert from that into a temp table (or staging table) and from there into the production table to make sure the update isn't slowed down by the cross server transfer.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -