If you ever needed to script a table in SQL Server Management Studio (SSMS), you might have noticed that simply right-clicking the table, selecting "Script table as" will not include indexes:
This is usually an issue, especially when you are using this script to integrate the tables into a DevOps deployment. After all, missing indexes can/will cause the environment to behave different than expected.
Luckily, there's an easy solution. In SSMS, select "Tools" -> "Options". Find "SQL Server Object Explorer" -> "Scripting" -> "Table and view options" -> "Script Indexes", and set the value to "True":
Now, when you script a table, the index(es) on it will automatically be scripted, too:
This is usually an issue, especially when you are using this script to integrate the tables into a DevOps deployment. After all, missing indexes can/will cause the environment to behave different than expected.
Luckily, there's an easy solution. In SSMS, select "Tools" -> "Options". Find "SQL Server Object Explorer" -> "Scripting" -> "Table and view options" -> "Script Indexes", and set the value to "True":
Now, when you script a table, the index(es) on it will automatically be scripted, too: