2

We have an application that updates the database schema at times. We're using AdoX.Index.Delete to remove some indexes before we create newer indexes. It seems that adox is generating a sql statement that checks if the index exists in sysobjects and that the uid matches the current user's id. That doesn't make sense to us, and causes problems if a user is not sysadmin in SQL. In this case, the user_name(uid) = user_name() in sysobjects doesn't match and the index is not deleting.

Are there additional parameters we need to pass when constructing the adox object, or is this something inherent in how adox works?

We don't understand why the user_name test is being performed at all.

The generated sql statement goes like this:

if exists(select * from sysobjects where name='TABLE_NAME_PK_i1' and user_name(uid)=user_name() and type ='K') 
alter table TABLE_NAME drop constraint TABLE_NAME_PK_i1 else drop index TABLE_NAME.TABLE_NAME_PK_i1
Étienne Laneville
  • 4,697
  • 5
  • 13
  • 29

0 Answers0