[dba-SQLServer] Drop index in another database

jwcolby jwcolby at colbyconsulting.com
Wed Oct 7 07:31:10 CDT 2009


Sorry guys, I found it as soon as I pressed send.

Thanks,

John W. Colby
www.ColbyConsulting.com


jwcolby wrote:
> I am attempting to write a stored procedure that exists in a database of stored procedures.  This 
> stored procedure needs to create an index on a table in a database and table which are passed in 
> parameters, update a field in that database / table, then drop the index when done.
> 
> In studying the drop index syntax it clearly states "in the current database".
> 
> Does SQL (the language) not have syntax for dropping an index in a table in a different database 
> from the one the SQL statement exists in?
> 
> Is it possible to use something like
> 
> Use @DBName to cause this to work?
> 
> Is there something else I should be doing (other than a different line of work ;)
> 



More information about the dba-SQLServer mailing list