Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Disappearing Indexes

Author  Topic 

davidpardoe
Constraint Violating Yak Guru

324 Posts

Posted - 2001-09-17 : 09:15:19
Does anyone know why indexes may be dropped implicitly. I create a table within an sp using the following dynamic SQL. The last bit creating the index on the urn (cis_id). After doing a variety of other things the index seems to have disappeared. Any thoughs as to why. What actions may get rid of it without me realising?

set @sql2 = 'if exists (select name from '+@database+'.dbo.sysobjects '
set @sql2 = @sql2 +'where name=''' + @tablename+'_NUMBERS'' and type =''U'') '
set @sql2 = @sql2 + 'drop table ' +@database+'.dbo.'+ @tablename+'_NUMBERS '
set @sql2 = @sql2 + 'select cis_id'+@transcodeall+'into '+@database+'.dbo.'+ @tablename+'_NUMBERS'
set @sql2 = @sql2 +' from '+@database+'.dbo.'+@tablename
set @sql2 = @sql2 +' create index i_NUMBERS on '+@database+'.dbo.'+ @tablename+'_NUMBERS(cis_id) '

exec (@sql2)


============
The Dabbler!
   

- Advertisement -