在SQL Server中生成CREATE INDEX语句 [英] Generate CREATE INDEX statements in SQL Server
问题描述
有没有人有脚本列出SQL Server数据库中所有现有索引的CREATE INDEX语句?
Does anyone have a script to list of CREATE INDEX statements for all existing indexes in a SQL Server database?
此主题所有索引和列表的列表SQL Server DB中的索引列提供了有关如何查找它们的重要提示。但是生成 CREATE INDEX
语句的脚本会很棒。有时我们遇到没有足够数据的情况,或者在没有文档的情况下以特别方式添加索引,因此缺少create语句。就像我现在发现自己的情况一样。
This thread List of all index & index columns in SQL Server DB has great tips on how to find them. But a script to generate the CREATE INDEX
statements would be great. Sometimes we come into a situation without adequate data, or indexes have been added in an ad-hoc manner over time without documentation, so the create statements are missing. Like in a situation I find myself in right now.
谢谢。
推荐答案
使用SQL Management Studio中的生成脚本并选择脚本索引选项(在高级脚本选项下)
Use Generate Scripts from SQL Management Studio and choose the "Script Indexes" options (under Advanced Scripting options)
这篇关于在SQL Server中生成CREATE INDEX语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!