SQL Server Tutorials

How to update a database to match your diagram in SQL server

Developers save their database diagram when they are ready to update the database to match their diagram. On the other hand if other users have updated the database since developers opened their diagram, users’ changes might affect developers’ diagram and vice versa. When developers save their diagram, the database will be reconciled with their diagram by …

Learn more

How to stop a query in SQL server

Developers can stop the query if it has not already finished, or if they see that the query is taking too long or is not returning the results they expect. When developers working with SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 want to stop a query, they should do the …

Learn more

How to define check constraint expressions from GUI in SQL server

Developers can create a simple constraint expression to check data for a simple condition; or they can create a complex expression, using Boolean operators, to check data for several conditions. For example, suppose the client table has a county code (ccode) column where a 3-alphabetic character string is required. This sample constraint expression guarantees that only 3-alphabetic characters …

Learn more

How to change index properties in SQL server

When Developers working with SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 want to change index properties, they should follow the next steps:

1. In Object Explorer, right-click the table they want to open and click Design (Modify in SP1 or earlier).

2. From the …

Learn more

How to check existing data when creating a relationship in SQL server

When Developers working with SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 want to check existing data when they are creating relationship, they should follow the next steps:

1. In Object Explorer, right-click the table that will be on the foreign-key side of the relationship and click Design …

Learn more

How to modify a foreign key from GUI in SQL server

Developers modify the foreign key side of a relationship if they want to change which columns are related to columns in the primary key table. To modify a foreign key they should follow the next steps:

1. In Object Explorer, right-click the table with the foreign key, and click Design (Modify in SP1 or earlier). …

Learn more

How to modify the precision of a columns data type in SQL server

The precision of a numeric column refers to the maximum number of digits used by the selected data type. For most data types, the column precision is automatically defined by the data type. Developers can change the column precision for the decimal and numeric data types if they want to redefine the column length. The Precision …

Learn more

How to modify the length of a columns data type in SQL server

The column length is automatically defined, when developers select a data type. Developers can reset the Length property for a column with a character data type, such as binary, char, nchar, nvarchar, varbinary, or varchar, if they want to increase or decrease the length of acceptable values in that column.  For columns with numeric data types, …

Learn more