HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

Create SQL Script for Statistics

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
scriptcreatesqlstatisticsfor

Problem

I wanna create script my whole table, including all statistics and indexes.

In SSM, When I right click table and create script, it gives me script for Indexes for not for statistics.

If I right click indexes, then there is an option to generate script, but this option is disabled when I right click Statistics.

Can anyone tell me how do I generate script for statistics.

Thanks

Solution

In SSMS, open Tools -> Options and go to the "SQL Server Object Explorer" item in the left-hand pane. Expand that and you should see a "Scripting" subitem. From there, navigate to the "Table and View Options" section and you should see an option to say whether statistics are scripted or not.

Context

StackExchange Database Administrators Q#41203, answer score: 4

Revisions (0)

No revisions yet.