Click here to Skip to main content
15,881,852 members

Comments by Mustafa Ismail Mustafa (Top 18 by date)

Mustafa Ismail Mustafa 12-Sep-11 8:35am View    
Hmmm.. CTE is the only way to go. But this would be very bad on large tables, say 10,000 or more records. I do not think I would exaggerate when I would say that on a humble machine, the entire server would grind to halt until the process is done. Have you considered simply grabbing them without the need for a serial number? Or is there a specific need for the serial number? You could create a non-serial identifier.
Mustafa Ismail Mustafa 12-Sep-11 3:48am View    
But the serial number was already 3!

I'll assume that that was a typing mistake and what you wanted was to set it N + 1, where N is the current highest serial number value for that particular city, correct? Also, does that mean you want to change the values of ALL the other serial numbers of the previous city so you wouldn't have a gap? For example, Chennai has 1,2,3 and Agra has 1,2,3,4, Agra 3 moves to Chennai, Chennai now has 1,2,3,4 and Agra now has 1,2,4, do you want to update the 4 as well (and any trailing serial numbers) to reflect the correct order or it doesn't really matter?
Mustafa Ismail Mustafa 11-Sep-11 9:42am View    
That is C#. SQL-DMO (Database Management Object) are a high level .NET library to access high level functions. I'm almost 100% sure that there is no way to alter indexes from C# without doing it this way. This might help you (CP Article).
Mustafa Ismail Mustafa 11-Sep-11 9:34am View    
This is what you are looking for then reference. But beware, this will be discontinued in the next edition of SQL server.

If this answers your question, don't forget to mark the question as answered. But I'm still pretty certain you should not be doing something like this at runtime.
Mustafa Ismail Mustafa 7-Jun-11 7:53am View    
It worked! The question is why?! Why should it matter that I used an event to set the value whilst I cannot do it explicitly?