Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. SQL Server
  3. Question
SQL Server

How to add a Default constraint while creating a table in SQL Server?

Asked by Danna Sahi Apr 22, 2021 1.8K views 1 answer
Share

About this question

I am trying to create a new table with columns followed by their constraint as shown below. Create tblTest( columns.. .. .. Gender int, Constraint DF_tblTest_Gender Default 3 For Gender, .. .. .. )

However, I am getting an error message near the default constraint as, 'Incorrect syntax near 'for'' What are SQL Server constraints?

Your answer

1 Answer