Programming Data Constraints Using Microsoft SQL Server

Sanjiv Purba · Auerbach Publications eBooks · 2021

Microsoft® structured query language (SQL) server was one of the first widely released database servers to support functionality of coding data constraints directly inside the data dictionary itself — as far back as 1987 in collaboration with Sybase. These constraints are attached to tables or table fields with the ANSI ‘98 Data Definition Language commands, “create table” and “alter table.” This chapter provides examples of data scripts that will support the following: Identity Constraints, Key Constraints, and Default Constraints. A common requirement in transactional systems is to generate a sequential number for each row that is inserted into a table. SQL Server’s response has been the identity constraint. This feature is identified for a maximum of one column in a table at the time the table is created or altered. There are two basic key column constraints that can be applied to table columns with the CREATE TABLE and the ALTER TABLE commands, namely PRIMARY KEY and FOREIGN KEY.

Read the paper · More papers on PaperTik