April 15, 2008 at 1:23 am
Hi all,
I am using SQL SERVER 200.I want to disable created indexes on a table
i tried the following sql , it throwing error
alter index FIRST_REF on tblComponentComponentJoin DISABLE
can anybody help in this is highly appreciated
Thanks
shamsudheen
April 15, 2008 at 1:51 am
There's no way to disable an index in SQL 2000. You'll have to drop it.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 15, 2008 at 1:57 am
Thanks Gail Shaw
i have another question related to this topic. i am having a view of joining two table with one key and each table have multiple indexes.my question is when i run the view is it will use the indexes or not
thanks
April 15, 2008 at 6:00 am
Maybe. It depends on the queries run, the data distribution, the indexes you have. It's not a question that can be answered in general.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 15, 2008 at 6:27 am
First, having an index on a table won't slow down reads of that table assuming the reads use a different index. Second, get an execution plan for the query and then you'll know which indexes it uses or doesn't. Just a reminder, while an index scan is "using" the index, it isn't necessarily using it well.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
April 17, 2008 at 11:33 am
With Gail and Grant of course. It also depends on how you and where you are putting the [where] condition in your join. Like what Gail said, there is no general answer for this. You will have to run the query and see the execution plan and see it from there.
[font="Verdana"]Imagination is more important than knowledge-Albert Einstein[/font]
April 17, 2008 at 9:44 pm
SQL King (4/17/2008)
With Gail and Grant of course. It also depends on how you and where you are putting the [where] condition in your join. Like what Gail said, there is no general answer for this. You will have to run the query and see the execution plan and see it from there.
hi
in my query i only join with keys no filter condition . i found it is still using index.Thanks Gai,Grant and Sql king for your effort
April 17, 2008 at 10:19 pm
Check this whether it works or not:
ALTER INDEX [IX_name] ON table DISABLE
GO
I don't have 2000 so I can't test it but found this solution in 2-3 sites.
Hope it works.:)
Also read these articles:
http://blog.sqlauthority.com/2007/05/17/sql-server-disable-index-enable-index-alter-index/
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/tunesql.mspX
April 18, 2008 at 12:08 am
Anirban Paul (4/17/2008)
Check this whether it works or not:ALTER INDEX [IX_name] ON table DISABLE
GO
Alter Index is only 2005 and higher. 2000 didn't have the command at all.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 18, 2008 at 12:44 am
GilaMonster (4/18/2008)
Anirban Paul (4/17/2008)
Check this whether it works or not:ALTER INDEX [IX_name] ON table DISABLE
GO
Alter Index is only 2005 and higher. 2000 didn't have the command at all.
As I told you I couldn't check as I found in under SQL Server 2000 in some sites. I never used it when I was using SQL Server 2000. I used to drop indexes. So when I saw in sites I thought let me put it in the forum to clear my doubts. Thanks Gail for your comment.
:):)
April 18, 2008 at 3:53 am
Anirban Paul (4/18/2008)
As I told you I couldn't check as I found in under SQL Server 2000 in some sites.
No worries. I just wanted to clarify things
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 18, 2008 at 5:34 am
GilaMonster (4/18/2008)
Anirban Paul (4/17/2008)
Check this whether it works or not:ALTER INDEX [IX_name] ON table DISABLE
GO
Alter Index is only 2005 and higher. 2000 didn't have the command at all.
You are right, i also droping and recreating, it is working fine
can i ask you one more question which i already posted , but i did not recieve solution
following is my query
SET @strSql = 'SELECT * FROM ' + @strViewName
EXEC @rowcount = sp_executesql @strSql
in @rowcount i am getting return value 0 . but i wand rows affected value
can you help me.
thanks in advance
April 18, 2008 at 5:58 am
What you're getting back from sp_executesql that way is the return value. Traditionally that's 0 if there was no error, otherwise it's the error code. But that depends on the implementation of sp_executesql
Try
SET @strSql = 'SELECT * FROM ' + @strViewName
EXEC sp_executesql @strSql
select @rowcount = @@rowcount
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply