April 6, 2016 at 3:42 am
Some developer dropped a table in Dev.
I script the table but it does not include the indexes.
What do I need to do to include the indexes?
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
April 6, 2016 at 3:49 am
Script them separately (right click index, script), or use the Generate Scripts wizard, specify just the table and use the Advanced button (on the 'set scripting options') page to include indexes, constraints, triggers or whatever else you want to.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 6, 2016 at 4:09 am
If you want to include them when you script a table go to the following on SSMS:
Tools --> Options --> SQL Server Object Explorer --> Scripting --> under "Table and view Options" change the "script indexes" flag to "True"
What should happen is the create indexes statements should appear with the create table syntax when you script right-click the object and script it out.
April 6, 2016 at 5:55 am
As a part of your development process, I strongly recommend you get your database into source control. This gives you the ability to track changes and, quite importantly, easily recover when something goes wrong. In terms of development, this is as important as backups are in production.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
April 6, 2016 at 9:48 am
shaneoneillis (4/6/2016)
If you want to include them when you script a table go to the following on SSMS:Tools --> Options --> SQL Server Object Explorer --> Scripting --> under "Table and view Options" change the "script indexes" flag to "True"
I keep forgetting that exists.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 6, 2016 at 9:51 am
GilaMonster (4/6/2016)
shaneoneillis (4/6/2016)
If you want to include them when you script a table go to the following on SSMS:Tools --> Options --> SQL Server Object Explorer --> Scripting --> under "Table and view Options" change the "script indexes" flag to "True"
I keep forgetting that exists.
It does not upset me that you keep forgetting what I only learned recently :crying:
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply