Wednesday, March 28, 2012

Index rename

What's a SQL statement for renaming an existing index. I know how to add an
index at the time that the table is created, but how do you rename an
existing index.
E. coli Happens.
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...amming/200512/1Check out sp_rename in the Books Online.
Hope this helps.
Dan Guzman
SQL Server MVP
"HockeyFan via webservertalk.com" <u16651@.uwe> wrote in message
news:58d63becf3fe8@.uwe...
> What's a SQL statement for renaming an existing index. I know how to add
> an
> index at the time that the table is created, but how do you rename an
> existing index.
> --
> E. coli Happens.
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Forum...amming/200512/1|||> What's a SQL statement for renaming an existing index.
Books Online is your friend.
EXEC sp_rename 'tablename.indexname', 'newname', 'index'|||too bad there's not a search.
Aaron Bertrand [SQL Server MVP] wrote:
>Books Online is your friend.
>EXEC sp_rename 'tablename.indexname', 'newname', 'index'
E. coli Happens.
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...amming/200512/1|||To make sure that I don't rename something else, I'm hoping to verify that
the "table.indexname" is also not the name of a column. I want to get the
correct item to rename. Maybe that can't be done with SP_Rename. since it
takes a string, not an object_ID.
HockeyFan wrote:
>too bad there's not a search.
>
>
E. coli Happens.
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...amming/200512/1|||> too bad there's not a search.
But there is. Also, I found the topic very quickly in the index by typing
'renaming indexes'.
Hope this helps.
Dan Guzman
SQL Server MVP
"HockeyFan via webservertalk.com" <u16651@.uwe> wrote in message
news:58d681f6f81ec@.uwe...
> too bad there's not a search.
> Aaron Bertrand [SQL Server MVP] wrote:
> --
> E. coli Happens.
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Forum...amming/200512/1|||> To make sure that I don't rename something else, I'm hoping to verify that
> the "table.indexname" is also not the name of a column.
That's what the third parameter is for. Notice I say 'index' and not
'column'...|||> too bad there's not a search.
? There sure is.|||There's one that you can limit the search just to a particular book?
Aaron Bertrand [SQL Server MVP] wrote:
>? There sure is.
E. coli Happens.
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...amming/200512/1|||> There's one that you can limit the search just to a particular book?
Well, I searched for "rename index SQL Server" at msdn.microsoft.com and
sp_rename came up on the first page (and it was the first one that said
anything about Transact-SQL).
If you want an easier way to limit you search to SQL Server only, then
install Books Online on your own computer (if it isn't there already).
See http://www.aspfaq.com/2229 for information about where to find Books
Online on your own computer, and where to get it if you don't already have
it installed. The download for SQL Server 2000 is currently broken, so you
may want to download the SQL Server 2005 edition. However, note that some
content is not applicable to SQL Server 2000 (though the basic gist of the
sp_rename topic should get you going), and you will need to have the .Net
2.0 Framework installed.
A

No comments:

Post a Comment