SQL Server Tutorials

How to create a primary key in SQL Server Table Designer

Developers define a primary key to to enforce uniqueness for values entered in specified columns that do not allow nulls. A table can have only one primary key. Primary keys is used to relate the table in which is defined to other tables in the database. In this way the need for redundant data is reduced. Developers should …

Learn more

How to change relationship properties in SQL Server Table Designer

When developers create a relationship, referential integrity between tables is enforced by default. An enforced relationship ensures each value entered in a foreign key column matches an existing value in the related primary key column. Developers

can change the conditions under which referential integrity is enforced by editing the relationship’s properties. When Developers working with SQL Server “Denali”, MS …

Learn more

How to create indexes in SQL Server Table Designer

Developers use indexes to speed access to data in a database table. They create an index by selecting one or more columns in a table that they want to be able to search on. They can use the index as soon as they save the table. When Developers working with SQL Server “Denali”, MS SQL Server 2008 R2 …

Learn more

How to create a unique constraint in SQL Server Table Designer

Developers create a unique constraint to ensure no duplicate values are entered in specific columns that do not participate in a primary key. While both a unique constraint and a primary key enforce uniqueness, developers should attach a unique constraint instead of a primary key constraint to a table if:

– They want to enforce uniqueness in …

Learn more

How to delete columns from a table in SQL Server Table Designer

Developers can use SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 Table Designer to delete a column. When developers delete a column, once they save the changes, the column and all the data it contains are deleted from the database. The only way to restore a deleted column is to close the table …

Learn more

How to specify a computed column in SQL Server Table Designer

Developers can specify an expression for a computed column in Table Designer. A computed column expression can use data from other columns to calculate a value for the column to which it belongs. When developers working with SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 want to specify a computed column, they should …

Learn more

How to modify a primary key in SQL Server Table Designer

Developers modify a primary key when he/she wants to change the column order, index name, clustered option, or fill factor. In this case Developers follow the next steps:

1. Open the Table Designer for the table whose primary key they want to modify, right-click in the Table …

Learn more

How to create relationships between tables in SQL Server Table Designer

Developers create a relationship between two tables when they want to associate rows of one table with rows of another. When Developers working with SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 want to create relationships between tables, they should follow the next steps:

1. In Object Explorer, right-click the table that …

Learn more

How to create unique indexes in SQL Server Table Designer

Developers, in Microsoft SQL Server, create a unique index on a unique column (such as product id) or on a set of columns that together uniquely identify each record (such as vendor + product).When Developers create or modify a unique index, they can set an option to ignore duplicate keys. If this option is set to Yes and …

Learn more

How to modify a unique constraint from SQL Server GUI

Developers modify a unique constraint when they want to change the columns that the constraint is attached to, change the constraint name, or set additional properties for the constraint. In this case they should follow the next steps:

1. In their database diagram, right-click the table containing the constraint, then select Indexes/Keys …

Learn more