A database project can contain one or more connections to databases. Each database contains database objects such as tables, queries, views, relationships, and indexes, in addition to the database's data.
You can create and modify the database objects and the data in three ways:
You use SQL scripts to give you complete control over the database, its objects, and its data. SQL scripts are files containing SQL statements that create and modify databases and database objects.
To populate a database project using SQL script files
Tips Microsoft® Visual InterDev™ supplies a number of templates you can use to add SQL script files to your database project. When you right-click on a database project or one of its data connections and select the Add SQL Script command, the following templates are available: New SQL Script, New Stored Procedure Script, New Table Script, New Trigger Script, and New View Script.
The New SQL Script template adds a generic SQL script file to your database project, which you can use to create or modify any type of database object. The other templates create SQL scripts specific to SQL Server database objects.
You can also right-click a SQL Server database object in the Data View window and choose the Copy SQL Script command. You can then paste this SQL script into the SQL editor or directly into a database project. This creates an SQL script, which, when run against the database, will create the database object you selected.
You can also select multiple database objects in the Data View window and use the Copy SQL Script command to create an SQL script that you can add to a database project and use to create all the selected database objects. In addition to SQL Server database objects, the Copy SQL Script command also works with Oracle views, triggers, stored procedures, and functions, but not with Oracle tables and synonyms.
When you add a data connection to a database project, the data connection and database objects are displayed in Data View. You can edit the database objects directly. This is the easiest way to create and modify database objects and data, but you don't have as much control over the database as you do with SQL scripts.
To populate a database project using Data View
The Query Designer and Database Designer allow you to create and modify queries, tables, and objects associated with tables such as indexes, constraints, and relationships.
To populate a database project using the Database Designer
–or–
Create a new table or new database diagram from the shortcut menu.
To populate a database project using the Query Designer
–or–
Choose the New Query command from the shortcut menu.
For information on how to use the Query Designer and Database Designer, see Working with Database Projects.