Problem solve Get help with specific problems with your technologies, process and projects.

Where are default constraint values stored?

In SQL Server, where are the values for the default constraint for a particular column stored? What is the column name that holds the value?

Implementing a default value for a column, if a value is not passed, is a great best practice when developing systems,...

because all of the logic is inline to the table. As such it is not necessary to write complex logic if a value is not passed and if a NULL value is not inserted.

To find the values it is necessary to query the syscolumns table for the particular column. The syscolumns table resides in the user database and stores one record for each column in a specific table. The syscolumns table also has a column named 'cdefault' that serves as an ID for the column and references syscomments. The syscomments table stores the definition of the default in the 'text' column.

For more information about defaults visit:
Creating and Modifying DEFAULT Definitions


For More Information

This was last published in April 2004

Dig Deeper on SQL Server Stored Procedures

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.