See sp_rename in BOL.
P
-----Original Message-----
From: [Email Address Removed] Wednesday, April 28, 2004 10:01 AM
To: LazyDBA.com Discussion
Subject: Cycle through indexes in each table in a DB and rename indexes
Hi
hope someone can give me a pointer on this one.
I am coming up against error 3125 - problems linking tables from a SQL database to an Access97 database (problem occurs when table name and longest index name exceeds 64 characters).
I would like to create an SQL script which would cycle through each of the indexes for each table in the DB and where table name and index name => 64 characters, rename the index to something shorter. (e.g. rename to index1, index2, index3 etc using a counter to provide number suffix).
I'm a complete novice when it comes to SQL scripting and would greatly appreciate any help available.
Gordon
Gordon McGill
Manager
Corporate Banking
Credit Risk, Credit Systems
* Ext: 86322 DDI: 0131 347 6322
* Fax: 0131 347 6190
* Email: [Email Address Removed] Address: 4th Floor, Citymark, Edinburgh.
*******************************
--
------------------------------------------------------------------------------
The information contained in this message is confidential and is intended for the addressee only. If you have received this message in error or there are any problems please notify the originator immediately. The unauthorised use, disclosure, copying or alteration of this message is strictly forbidden. This mail and any attachments have been scanned for viruses prior to leaving the HBOS network. HBOS will not be liable for direct, special, indirect or consequential damages arising from alteration of the contents of this message by a third party or as a result of any virus being passed on.
HBOS reserves the right to monitor and record e-mail messages sent to and from this address for the purposes of investigating or detecting any unauthorised use of its system and ensuring its effective operation.
HBOS plc, Registered in Scotland No. SC218813. Registered Office: The Mound,
Edinburgh EH1 1YZ. HBOS plc is a holding company, subsidiaries of which are regulated by the Financial Services Authority.
==============================================================================
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Get today's cartoon: http://www.LazyDBA.com
To unsubscribe, e-mail: mssqldba-[Email Address Removed] ,
then respond to the confirmation email you get
For additional commands, e-mail: mssqldba-[Email Address Removed]MS Sql Server LazyDBA home page