Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server: alter table, how to add SPARSE definition

I would like alter my table and add SPARSE option to all fields that contain a lot of NULL values. What is the right syntax for this ALTER TABLE command?

like image 809
jrara Avatar asked Sep 30 '11 11:09

jrara


1 Answers

The other answers work, but you can also get away with:

ALTER TABLE #foo ALTER COLUMN bar ADD SPARSE;

This way you don't have to look up the column's type or nullability.

like image 153
Atario Avatar answered Oct 25 '22 01:10

Atario