Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Generate Create View statements for database tables.

By Wes Henriksen,

In a refactoring project, we determined we needed to put our maintenance and logging tables in a serperate database from the customer data.

I created this statement to create views pointing to the new table locations to maintain backward compatibility for existing objects.

I recommend you run this on the new database location as it will include the reference to the new database in the defintion.  Otherwise, you'll want to update the code to hardcode your new database name.

Hope this saves you some time creating views!

Total article views: 1004 | Views in the last 30 days: 7
 
Related Articles
FORUM

Create Database

Create database taking forever

FORUM

create database security

create database security

FORUM

unable to create database

CREATE DATABASE failed

FORUM

create the database

create the database

FORUM

Problems in creating database snapshots

Problems in creating database snapshots

 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones