📄 6345.htm
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MS SQL基础教程:查看与修改索引 - 编程入门网</title>
<meta name="keywords" content="MS SQL基础教程:查看与修改索引">
<meta name="description" content="MS SQL基础教程:查看与修改索引">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="/images/style.css" rel="stylesheet" type="text/css" />
<script src="/js1/head.js"></script>
</head>
<body leftmargin="0" topmargin="0" bgcolor="#efefef" oncopy=nocopy()>
<TABLE width="760" cellPadding="0" cellSpacing="0" bgcolor="#eff7fe" align="center">
<TR>
<TD><a href="/index.htm"><img src="/images/logo1.gif" width="150" height="60" border="0"></a></TD>
<TD width="470" align="right"><script src="/js1/top.js"></script></TD>
<TD width="125" align="center"><script src="/js1/topsy.js"></script></TD>
</TR>
</TABLE>
<table width="760" border="0" cellpadding="1" cellspacing="0" class="bklan" align="center">
<tr>
<td align="center" bgcolor="#eff7fe" height="24"> | <a href='/Programming/index.htm'>编程语言</a> | <a href='/webkf/index.htm'>web开发</a> | <a href='/data/index.htm'>数据库</a> | <a href='/Network/index.htm'>网络技术</a> | <a href='/OS/index.htm'>操作系统</a> | <a href='/Servers/index.htm'>服务器</a> | <a href='/web/index.htm'>网页设计</a> | <a href='/Design/index.htm'>图形设计</a> | <a href='/Office/index.htm'>办公软件</a> | <a href='/soft/index.htm'>常用软件</a> | <a href='/shadu/index.htm'>杀毒频道</a> | <a href='/PC/index.htm'>学电脑</a> |</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" width="760" align="center" bgcolor="#ffffff" border="0">
<tr>
<td align="center"><script src="/js1/content1.js"></script></td>
</tr>
</table>
<table width="760" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td height="25" background="/templets/img/31bg3.gif" align="left" class="guidet"> → 当前位置:<a href='http://www.bianceng.cn/'>首页</a>→<a href='/data/index.htm'>数据库</a>→<a href='/data/SQLServer/index.htm'>SQL Server</a>→<a href='/data/SQLServer/jc/index.htm'>SQL Server教程</a>→正文</td>
</tr>
</table>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td valign="top" class="guidet" width="595"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="ct">
<tr>
<td align="center" valign="middle" class="til"><h3> MS SQL基础教程:查看与修改索引 </h3>
发布时间:2007-12-25 来源:网络/责编:编程入门 作者:佚名<br />
<script src="/js1/468.js"></script>
</td>
</tr>
<tr>
<td style="font-size:14px" align="left" class="til"><table border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><script src="/js1/300.js"></script></td>
</tr>
</table><p> 8.3.1 用Enterprise Manager 查看、修改索引</p>
<p> 在Enterprise Manager 中选择要查看的数据库,然后在任务板中选择“Tables & Indexes”页框,则会在任务板中显示此数据库的所有用户表的索引信息,如图8-11 所示。</p>
<p> <img onclick="get_larger(this)" alt="" src="/upimg/allimg/070501/2015430.gif" /></p>
<p> 要查看并修改索引的详细信息,需要在所要查看的表上单击右键,从快捷菜单中选择 “All Tasks”子菜单中的“Manage Indexes” 选项,将出现如图8-9 所示的索引管理对话框。选择要查看或修改的索引,单击“Edit” 按钮,出现如图8-12 所示的修改索引对话框。</p>
<p> <img onclick="get_larger(this)" alt="" src="/upimg/071226/11b6120HM01191M.gif" /></p>
<p> 在图8-12 所示的修改索引对话框中,可以修改索引的大部分设置,还可以直接修改其SQL 脚本,只需按下“Edit SQL… ”按钮,即可显示如图8-13 所示的SQL 脚本编辑框。可以在其中编辑、测试和运行索引的SQL 脚本。</p>
<p> 但在图8-13 的索引的SQL 脚本编辑对话框中不能修改索引的名称,程序方式的索引名称修改需要使用系统存储过程Sp_rename 。要在企业管理器中修改索引的名称,改变其所属文件组等其它信息,则需要在表的属性对话框中进行,如图8-14 所示。应注意,图 8-14 所示的属性对话框是从图7-4 所示的修改表结构对话框中调用的,而不是直接通过快捷菜单的“属性”菜单项调用。</p>
<p> <img onclick="get_larger(this)" alt="" src="/upimg/071226/11b6120IR012Y61.gif" /><img onclick="get_larger(this)" alt="" src="/upimg/071226/11b6120J6013b16.gif" /></p>
<p> 8.3.2 用存储过程Sp_helpindex 查看索引</p>
<p> Sp_helpindex 存储过程可以返回表的所有索引的信息。其语法如下:</p>
<p> sp_helpindex [@objname =] 'name'</p>
<p> 其中[@objname =] 'name'子句指定当前数据库中的表的名称。</p>
<p> 例8-4: 查看表orders 的索引。</p>
<p> exec sp_helpindex orders</p>
<p> 运行结果如下</p>
<p> <img onclick="get_larger(this)" alt="" src="/upimg/071226/11b6120KL01430P.gif" /></p>
<p> 8.3.3:用存储过程Sp_rename 更改索引名称</p>
<p> 例8-5 更改orders 表中的索引orders_quan 名称为orders_quantity。</p>
<p> exec sp_rename 'orders.[orders_quan]', 'orders_quantity', 'index'</p>
<p> 运行结果如下:</p>
<p> ------------------------------------------------------------------------------------------------------------------------</p>
<p> Caution: Changing any part of an object name could break scripts and stored procedures.</p>
<p> The index was renamed to 'orders_quantity'.</p>
<p> <a href="/data/SQLServer/jc/200712/6352.htm">查看全套"MS SQL入门基础教程"</a></p><center><br /><script src="/js1/4682.js"></script></center>
<p>上一篇:<a href='/data/SQLServer/jc/200712/6344.htm'>MS SQL基础教程:创建索引</a> 下一篇:<a href='/data/SQLServer/jc/200712/6346.htm'>MS SQL基础教程:删除索引</a> </p></td>
</tr>
<tr>
<td align="left" style="font-size:14px;" height="25"><IMG src="/images/t0.gif" width="12" height="12" align=absMiddle><strong>相关文章</strong><br /><table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6344.htm">MS SQL基础教程:创建索引</a><br/>
</td>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6346.htm">MS SQL基础教程:删除索引</a><br/>
</td>
</tr>
<tr>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6343.htm">MS SQL基础教程:数据库索引</a><br/>
</td>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6347.htm">MS SQL基础教程:索引调整向导</a><br/>
</td>
</tr>
<tr>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6342.htm">MS SQL基础教程:SQL表的删除</a><br/>
</td>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6348.htm">MS SQL基础教程:创建和使用图表</a><br/>
</td>
</tr>
<tr>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6341.htm">MS SQL基础教程:查看表</a><br/>
</td>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6349.htm">MS SQL基础教程:数据完整性概述</a><br/>
</td>
</tr>
<tr>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6340.htm">MS SQL基础教程:SQL数据库表的修改</a><br/>
</td>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6339.htm">MS SQL基础教程:自定义数据类型</a><br/>
</td>
</tr>
<tr>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6351.htm">SQL Server与Access、Excel的数据转换</a><br/>
</td>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6338.htm">MS SQL基础教程:创建和使用约束</a><br/>
</td>
</tr>
<tr>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6352.htm">MS SQL Server入门教程</a><br/>
</td>
<td width='50%'>
·<a href="/data/SQLServer/jc/200712/6337.htm">MS SQL基础教程:创建数据库表</a><br/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="165" valign="top" class="guideb"><script src="/js1/1601.js"></script><table width="100%" border="0" cellpadding="0" cellspacing="0" valign="top">
<tr>
<td height="25" align="center" background="/templets/img/31bg3.gif"><strong>阅读排行</strong></td>
</tr>
<tr>
<td>·<a href="/data/SQLServer/jc/200712/6352.htm">MS SQL Server入门教程</a><br/>
·<a href="/data/SQLServer/jc/200807/10974.htm">MS SQL基础教程:存储过程</a><br/>
·<a href="/data/SQLServer/jc/200705/1189.htm">sql语言教程</a><br/>
·<a href="/data/SQLServer/jc/200807/10973.htm">MS SQL基础教程:创建存储</a><br/>
·<a href="/data/SQLServer/jc/200705/1182.htm">sql字符串函数</a><br/>
·<a href="/data/SQLServer/jc/200712/6301.htm">MS SQL基础教程:SQL Serve</a><br/>
·<a href="/data/SQLServer/jc/200712/6302.htm">MS SQL基础教程:SQL Serve</a><br/>
·<a href="/data/SQLServer/jc/200712/6314.htm">MS SQL基础教程:数据类型</a><br/>
·<a href="/data/SQLServer/jc/200705/1188.htm">Sql语言基础</a><br/>
·<a href="/data/SQLServer/jc/200712/6311.htm">MS SQL基础教程:Transact-</a><br/>
·<a href="/data/SQLServer/jc/200712/6312.htm">MS SQL基础教程:SQL变量</a><br/>
·<a href="/data/SQLServer/jc/200705/1184.htm">sql基本语句</a><br/>
·<a href="/data/SQLServer/jc/200807/10972.htm">MS SQL基础教程:管理存储</a><br/>
·<a href="/data/SQLServer/jc/200712/6306.htm">MS SQL基础教程:数据库基</a><br/>
·<a href="/data/SQLServer/jc/200705/1178.htm">sql数据表</a><br/>
</td>
</tr>
<tr>
<td><script src="/js1/1602.js"></script></td>
</tr>
<tr>
<td height="25" align="center" background="/templets/img/31bg3.gif"><strong>最新文章</strong></td>
</tr>
<tr>
<td><script src="/plus/js/0.js" language="javascript"></script></td>
</tr>
</table></td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" width="760" align="center" bgcolor="#ffffff" border="0">
<tr>
<td align="center"><script src="/js1/content2.js"></script></td>
</tr>
</table>
<table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
<tr height="26">
<td bgcolor="#e1f0fd" width="48"></td>
<td bgcolor="#6ab3f4" width="35"></td>
<td bgcolor="#0a518f" colspan="2" width="4"></td>
<td bgcolor="#c0c0c0" width="530" align="center"><a title="将本站设为你的首页" onclick="this.style.behavior='url(#default#homepage)';this.sethomepage('http://www.bianceng.cn');return false;" href="http://www.bianceng.cn/">设为首页</a> | <a class="navmenu"
title="将本站加入到你的收藏夹"
href="javascript:window.external.AddFavorite(location.href,document.title)">加入收藏</a> | <a href="/about/about.htm">关于本站</a> | <a href="/plus/flink.php">友情链接</a> | <a href="/about/banquan.htm">版权声明</a> | <a href="/plus/sitemap.html">网站地图</a> | <a href="/plus/rssmap.html">RSS订阅</a></td>
<td bgcolor="#0a518f" colspan="2" width="4"></td>
<td bgcolor="#6ab3f4" width="32"></td>
<td bgcolor="#e1f0fd" width="47"></td>
</tr>
<tr height="26">
<td colspan="9" bgcolor="#FFFFFF" align="center">编程入门网 版权所有,bianceng.cn,All Rights Reserved. <script src="/js/tongji.js"></script> 阅读次数:<script src="/plus/count.php?aid=6345&mid=0" language="javascript"></script></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -