Tables are database objects that contain all the data in a database. A table
definition is a collection of columns. In tables, data is organized in a
row-and-column format similar to a spreadsheet. Each row represents a unique
record, and each column represents a field within the record. For example, a
table containing employee data for a company can contain a row for each
employee and columns representing employee information such as employee number,
name, address, job title, and home phone number.
Operations available with tables are:
This operation allows you to add new table to the database:
Figure 1 Add New
Table
When Add New Table dialog box appears, you can enter valid
strings (see SQL Server 2000 Book Online), select data types from the dropdown
list, lengths (for some data type), select options for Allow Nulls dropdown
list (Yes or No, default to No), and default values. After you finish defining
the table, click on the Save button. The Enter Table Name dialog box
will pop up (see Figure 2). Enter the
name for the table in the dialog box and click on the OK button. The new
table with you defined columns and table name will be created.
Figure 2 Enter Table
Name Dialog
Edit Table option allows you to edit an existing table definition in the
database. Only the tables that are checked out or newly created and haven’t
been added into Visual SourceSafe can be edited. Otherwise, you can view the table
definition but not modifying it. To edit a table you can:
The editing process is similar to the process of adding new table. The existing table script is displayed in Script tab (see Figure 4). You can add new column in the table, delete a column or modify a column definition. You might experience some problem of changing an existing column data type to another one. Since existing data in the column of the table could not be changed to new data type automatically, some error might raise up. If you experience problems like this, please modify data type using SQL Enterprise Manager.
Figure 3 Edit an Existing Table (Design Tab)
Figure 4 Edit an
Existing Table (Script Tab)
The Triggers, Indexes/Keys and Check Constraints that are associated with the table are listed in the three list boxes at the bottom of the Design tab. You can add, edit or delete Triggers, Indexes/Keys and Check Constraints.
1. Add a new Trigger. Right click on the Trigger list box, then select Add New Trigger from the context menu. A Choose Trigger Type dialog box pops up. A unique name is given to the trigger by default. You can edit the name. You should also set the trigger type as for Insert, Update, Delete, or any combination of them. Click on the OK button, the Edit Trigger dialog box appears with default script (see Figure 6).
Figure 5 Choose
Trigger Type Dialog
You can edit the script for the trigger and click on the Check
Syntax button to check the syntax of the trigger. If there is no error in the script, you can click on the Save
button to save the trigger.
Figure 6 Edit
Trigger Dialog
2. Edit a Trigger. Right click on an existing trigger that you
want to edit. Select Edit Trigger from the context menu. The Edit
Trigger dialog box appears with the script of the trigger. Then you can edit
the script for the trigger.
3. Delete a Trigger. Right click on a trigger that you want to
delete. Select Delete Trigger
from the context menu. The trigger that associated with the table is deleted.
4. Add a new
Index/Key. This feature is
available for primary index only. For
other type of index/key, SQLSourceSafe does not support them directly. If you
need to edit them in your project, you can do all editing in SQL Enterprise
Manager. Then clicking the Refresh
button on the toolbar of SQLSourceSafe Main Window, the changed Index/Key will
be loaded from SQL Server to SQLSourceSafe.
For setting/removing Primary Index for a table, you can highlight
table column(s) that you want to be in the primary key, then right click the
row header, select Set Primary Key option from the context menu.
5. Edit an
Index/Key. This feature is not
available in current version SQLSourceSafe. Right clicking on an Index/Key item
in the list box, then select Edit Index/Key from the context menu. You
can view the property of the index/Key configuration (see Figure 7).
Figure 8 Edit Index/Key
Dialog
6. Delete an
Index/Key. Highlight the
Index/Key you want to delete, then select Delete Index/Key from the
context menu. The index/key will be
deleted.
7. Add a New Check
Constraint. Right click on the
Check Constraint list box, select Add Check Constraint from the context
menu. The Enter Constraint Name dialog box will pop up to prompt the name for
the constraint. After entering the name for the constraint, click on the OK
button. The Edit Constraint dialog box pops up. You can enter the script for
the constraint. Click on the Save button after you finish editing the
script (see Figure 8).
Figure 9 Edit Constraint
Dialog
8. Edit a Check
Constraint. Right click on the
item that you want to edit in the Check Constraint list box, select the Edit
Check Constraint from the context menu. The Edit Constraint dialog box will
pop up (see Figure 8).
9. Delete a Check
Constraint. Right click on the
item you want to delete in the Check Constraint list box, select the Delete
Check Constraint from the context menu. The constraint will be deleted.
This operation allows you to delete a table from the database.
To delete a table from the SQL Server Database, you can:
This operation allows you to rename a table.
SQLSourceSafe, 2003-2006 © Copyright, Best SoftTool, Incorporated