MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 3rd, 2013, 04:28 AM
alo123445 alo123445 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 2 alo123445 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 3 m 20 sec
Reputation Power: 0
Trigger before DROP or ALTER

Hi,
I have the following question:
I have an update skript which I cannot modify but which is very slow. To speed it up i created indexes on some of the tables.
The problem is that the script at some point will try to drop a column on which it has an index on. So i tried to find a solution for this by creating a trigger which will execute before a DROP statement but as I found out this is not possible. Also an trigger for an alter_table is not possible as it will only be executed after an succesful alter table. So how could I achieve to drop the index before the alter table drop column statement is executed? I know the exact statement, so could I somehow get an rewrite of the statement that is run?

Reply With Quote
  #2  
Old February 5th, 2013, 09:16 AM
gk53 gk53 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 71 gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 8 h 28 m 25 sec
Reputation Power: 8
Can you explain why you need to drop table column and recreate index during update? I think it is not right.
Drop index, alter table, create index will be always slow... and not looks right in update....

Reply With Quote
  #3  
Old February 6th, 2013, 06:41 AM
alo123445 alo123445 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 2 alo123445 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 3 m 20 sec
Reputation Power: 0
Hi,
the drop of the column is part of the update-procedure of an CRM-Application. The statements itselfs are from an .dll where I can`t get the sources for. So the dll is used to update the db, the only thing I can see is what the SQL-Profiler shows me. This way I found out how many indexes I could use to speed up the process. The creation and the drop of the indexes takes abiut 3min.
As one step of the update procedure takes about 20h without custom indexes (and there about 20 steps in total) I can`t let the profiler run all the time and I also don`t want to rewrite the whole updateprocedure just with the help of the SQL-Profiler.


It would not be a problem if the statement was an insert update or delete as I could use an "instead of" trigger. So I am seraching for something like an rewrite rule for actual queries or for something like an "instead of"-Trigger for an Alter Table statement.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Triiger before DROP or ALTER

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap