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
 General SQL Server Forums
 New to SQL Server Programming
 moving views to other databases

Author  Topic 

svicky9
Posting Yak Master

232 Posts

Posted - 2005-09-27 : 04:47:45
Hi

I have a few views i created in a database.I want them to be moved to another database with credentials like dbo.dsatabasename.tablename automatically adding up to the new views.
How can i do that

Vic

Vicky

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-27 : 04:52:35
Use Generate SQL Script option from EnterPrise Manager to script the views and run them in other Database

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2005-09-27 : 05:00:18
You could also extract the code - by running this on the source db

select c.TEXT FROM Syscomments c INNER JOIN sysobjects o
on o.ID = c.ID and o.xtype = 'V'


Duane.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-27 : 05:07:29
Use this to avoid system tables

Select view_definition from Information_Schema.views

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -