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]

 

Author Index -Pls Help-
Dil

2006-01-13, 7:23 am

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

Dil

2006-01-13, 7:23 am

Hi all

I hope am in the right group.
IF NO
Pls let me know

Dil

Jens

2006-01-13, 7:23 am

Sorry, didn=B4t see your post:

select * from sysindexes
where
id =3D OBJECT_ID(<Tablename> ) AND
name =3D <IndexName>=20


HTH, jens Suessmeyer.

Dil

2006-01-13, 7:23 am

Hi

Thank u So much Jens For u help

Dil

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com