From the course: Microsoft SQL Server 2022 Essential Training
Unlock this course with a free trial
Join today to access over 24,100 courses taught by industry experts.
Establish a default value - SQL Server Tutorial
From the course: Microsoft SQL Server 2022 Essential Training
Establish a default value
- In order to speed up data entry in your tables you can specify a default value that will appear in a column when no value is supplied. This way, you can simply skip over that field to accept the default or change it if it needs to be something different. For the Red30 Tech database, we found that most of our newer products are going to be in the ebooks category, so I want that to be the default value that'll get suggested when entering in new products. To make this change find the products table in the Red30 Tech database, right click on it and open up the design window. Then with the category column selected, take a look in the properties at the bottom of the screen and find the default value or binding property. Here I'll type in the value that we want to be supplied automatically, ebooks. When I press enter SQL Server wraps this in single quotation marks, which indicates that this is a text string. It also…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Choose appropriate data types2m 46s
-
(Locked)
SQL Server data type options7m 19s
-
(Locked)
Automatically assign record identities4m 54s
-
(Locked)
Primary key fields4m 35s
-
(Locked)
Establish a default value5m 1s
-
(Locked)
Check constraints5m 10s
-
(Locked)
Unique constraints6m 23s
-
(Locked)
Foreign keys4m 16s
-
(Locked)
Create a foreign key column5m 16s
-
(Locked)
Create relationships between tables5m 6s
-
-
-
-
-
-
-