From the course: Developing Microsoft SQL Server 2016 Databases

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Implement sparse columns

Implement sparse columns

- [Instructor] To implement sparse columns in a database, we'll use the sparse keyword during the column definition. Let's go ahead and take a look by creating a new database called ImplementSparseColumns and then jumping into it. Next, we'll go ahead and move this down a little bit, and then I'm going to create a new table called People, and the first column will be PersonID, it'll be the identity column, or the primary key, for this table. Then we'll have a field named FirstName, LastName, Suffix, AddressLines one and two, City, State, and Zip. Let's go ahead and highlight lines eight through 19, and execute them to create the table. Next I'm going to scroll down here, and I've got a new procedure here called InsertPeople, and its going to insert 5,000 records into the People table we just created. It'll do that by declaring a variable called I, and it'll its value to 5,000. Then, as long as I is greater than zero, it'll…

Contents