I have inherited an application (and associated MS SQL database) that was installed by a software vendor many years ago. We do not have any kind of vendor support at this point. Besides using the application, we also access the database independently of the application, often making updates to the database directly and querying data for reporting.
In an effort to improve performance, I deleted some unnecessary indexes and created others. This caused bugs in the application when it performs certain tasks. The application does not display any error messages of any kind, and seems to perform normally, but the database is not updated by the application as expected. I have no access to the source code.
My theory is that the application explicitly specifies a deleted index in a with(index) statement in one of its queries. This would cause the server to return an error instead of completing the query, and if the application suppresses the error, the user would be unaware that some tables were updated and others were not. What other ideas could cause this behavior?
Assuming my theory is correct, I still believe the index is actually unnecessary, and the application should never have specified the index. Perhaps a workaround would be to create a new index with the same name, but with the fewest amount of columns possible. Is there any way to create an index with no columns? Would creating an nonclustered index with the same column(s) as the clustered index be the most efficient? What does the optimizer do in this case - does it still make a plan to include these "bad" indexes that just reference the clustered index, or will it know to ignore the with(index) request?
I did run a trace to see what queries the application was running. I got a bunch of RPC calls like "exec sp_cursorfetch" and "exec sp_cursorexecute" (that I don't understand) instead of actual SQL. Perhaps I will ask about these in a separate question, but if you know how I can interpret or decode these statements into regular SQL then that would allow me to at least confirm my theory.