Domain Integrity in SQL Server

Domain integrity assures that every data in a field contains legitimate values, is established by the permitted values of an attribute. Data types such as decimal, character, and integer as well as the maximum length for data are what make up domain integrity.

Normally, we would define what kind of data and how much data the column should store during the table creation. For instance, the column Student Name typically contains string (text) values, the column “Date of payment” typically contains data in date format, and the column “Student Id” typically contains numeric values (integer data type). By specifying the data type, we are instructing the SQL Server not to store the data in any other data type than that which is given.

This rule is called domain integrity constraint.


CREATE TABLE tbStudentDetails(
—-iStudentID INT,
—-vcStudentName VARCHAR(40),
—-tiGroupID TINYINT,
—-sdtApplicationDate SMALLDATETIME,
—-vcFatherName VARCHAR(40),
—-vcAddress1 VARCHAR(20),
—-vcAddress2 VARCHAR(20),
—-vcCity VARCHAR(20),
—-bActive BIT)

Happy learning!!!

One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s