Re: Orphan Indexes?
From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 08/04/04
- Next message: AA: "Re: inserting deleted rows from a trigger to a SQL Linked Server"
- Previous message: oj: "Re: LEFT JOIN"
- In reply to: Andrew: "Re: Orphan Indexes?"
- Next in thread: Andrew: "Re: Orphan Indexes?"
- Reply: Andrew: "Re: Orphan Indexes?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 4 Aug 2004 20:25:58 +0200
Ahh, perhaps you are doing the DROP inside the proc, so the parser don't know of the existence yet (as they
haven't been created at parse time... or something like that. What if you use dynamic SQL to execute the DROP
INDEX statement?
-- Tibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://www.solidqualitylearning.com/ "Andrew" <AndrewR2k1@hotmail.com> wrote in message news:uVq5dhkeEHA.2044@TK2MSFTNGP10.phx.gbl... > Tried this already, still have the same problem. > > drop index dbo.t.x > drop index (username).t.x > > Makes no difference > > -- Andrew > > > "Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote in > message news:%23y5RhYkeEHA.4068@TK2MSFTNGP11.phx.gbl... > > Perhaps an owner issue for the table? You can specify the table owner in > DROP INDEX, as below shows: > > > > create table t(c1 int) > > create index x on t(c1) > > drop index dbo.t.x > > > > > > -- > > Tibor Karaszi, SQL Server MVP > > http://www.karaszi.com/sqlserver/default.asp > > http://www.solidqualitylearning.com/ > > > > > > "Andrew" <AndrewR2k1@hotmail.com> wrote in message > news:%23xuiWBkeEHA.1732@TK2MSFTNGP09.phx.gbl... > > > Hey all, > > > > > > I have run into a problem and I am completely lost.. I wrote a couple > > > stored procedures to be used by a little helper program to delete and > remake > > > a table, upload some data to the DB from a text file the program read > in, > > > and finally, apply a couple indexes to the newly made table > (TempPri2004). > > > > > > I ran into a snag in that when the program ran the SP's, the owner of > the > > > table is not the same as when I created the SP's in Query Analyzer. So, > I > > > added to the program a step that would run the SP "sp_changeobjectowner" > to > > > change the owner so my SP's would run. But now I have a major problem. > > > > > > I can no longer get rid of the indexes my SP created in the final step > of > > > the process. If I run the following query, I get a record back with the > > > Index name (it was found, in other words): > > > > > > "SELECT name FROM sysindexes WHERE name = 'NC_RaceLabel'" > > > Records returned: NC_RaceLabel > > > > > > But if I try the following, it bombs with the error given: > > > > > > "DROP INDEX TempPri2004.NC_RaceLabel" > > > Error: Cannot drop the index 'TempPri2004.NC_RaceLabel', because it does > not > > > exist in the system catalog. > > > > > > If I open SQL Server Enterprise Manager, expand the database for this > table, > > > right click the table, and select Manage Indexes, there is no items > listed > > > in the box. > > > > > > I am at a loss here. The indexes are listed in the "sysindexes" table > if I > > > query the table, but I am unable to drop them. Help?? > > > > > > -- Andrew > > > > > > > > > > > >
- Next message: AA: "Re: inserting deleted rows from a trigger to a SQL Linked Server"
- Previous message: oj: "Re: LEFT JOIN"
- In reply to: Andrew: "Re: Orphan Indexes?"
- Next in thread: Andrew: "Re: Orphan Indexes?"
- Reply: Andrew: "Re: Orphan Indexes?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|