|
Home > Archive > MS SQL Server > January 2006 > Index -Pls Help-
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| hi
I have used the following query for checking whether an index is
existing or not
SELECT name FROM sysindexes WHERE name = 'TESTINDEX'
This will return all indexes name 'TESTINDEX'
if the database contains 10 indexes named as 'testindex' it will show
all.
so how can I select an index which is associated with a particular
table.
Actually I want to run this query
USE db1
IF EXISTS (SELECT name FROM sysindexes WHERE name = 'TESTINDEX') DROP
INDEX MyTable.TESTINDEX
The IF EXISTS clause wil return true, if there is any other index have
the same name as TESTINDEX
Then when I try to delete It will show an error (Because MyTable does
not contains TESTINDEX)
How can I solve this issue
Pls help
Thanks in Advance
Dil
| |
|
| Hi all
I hope am in the right group.
IF NO
Pls let me know
Dil
| |
|
| Sorry, didn=B4t see your post:
select * from sysindexes
where
id =3D OBJECT_ID(<Tablename> ) AND
name =3D <IndexName>=20
HTH, jens Suessmeyer.
| |
|
| Hi
Thank u So much Jens For u help
Dil
|
|
|
|
|