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)
 Updating View code

Author  Topic 

ampo
Starting Member

6 Posts

Posted - 2009-05-11 : 04:07:33
Hello.

I have a View in my DB with a list of all databases specified in it:

SELECT * FROM DB_Name_1.dbo.TableName WITH (NOLOCK)
UNION ALL
SELECT * FROM DB_Name_2.dbo.TableName WITH (NOLOCK)
UNION ALL
SELECT * FROM DB_Name_2.dbo.TableName WITH (NOLOCK)
...
...

Can I use UserDefinedFunction or StoredProcedure to update this code with new database?

I want to perform it automatically and not open ("Edit") the View code each time.

In general - can View (or StoredProcedure) code be edited automatically?

Any help would be great.
Thanks.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-11 : 11:35:21
you can use stored procedure to update view. however the view should satisfy lots of conditions for it to become updatable.
Go to Top of Page
   

- Advertisement -