I would strongly question the need to manipulate database structure from ASP. In most cases database structure should be static. It is probably better to modify your application, so that front end would not need to make these sort of changes. Having said that, if you still feel you need to drop columns from ASP, you can drop them using a statement like: ALTER TABLE mytable DROP COLUMN mycolumnHowever, if a column you are trying to drop is a part of an index, or has other tables referencing it, you will not be able to drop it. The stored procedure below will drop all foreign keys referencing your column and all indexes containing it prior to attempting to drop the column. I have done very little testing, so be sure to test thoroughly if you decide to implement...CREATE PROCEDURE drop_column @owner varchar (100) = 'dbo', @table sysname, @col sysnameAS DECLARE @sql varchar (8000)DECLARE @idx_name sysnameDECLARE @stat int-- Make sure that such table/column existsIF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = @table AND TABLE_SCHEMA =@owner AND COLUMN_NAME = @col)BEGIN RAISERROR ('Invalid owner, table or column parameter', 16, 1) RETURN 1END--Pick a moment while nr isn't looking, create a cursor of foreign keys, referencing the field --Loop through and drop all of them.DECLARE cur_fks CURSOR FAST_FORWARD READ_ONLY TYPE_WARNINGFOR select 'ALTER TABLE '+ object_name(fkeyid) +' DROP CONSTRAINT [' + object_name(constid) + ']' FROM sysreferences WITH (NOLOCK) WHERE object_name(rkeyid) = @table and @col IN ( col_name(rkeyid, rkey1) , col_name(rkeyid, rkey2) , col_name(rkeyid, rkey3) , col_name(rkeyid, rkey4) , col_name(rkeyid, rkey5) , col_name(rkeyid, rkey6) , col_name(rkeyid, rkey7) , col_name(rkeyid, rkey8) , col_name(rkeyid, rkey9) , col_name(rkeyid, rkey10) , col_name(rkeyid, rkey11) , col_name(rkeyid, rkey12) , col_name(rkeyid, rkey13) , col_name(rkeyid, rkey14) , col_name(rkeyid, rkey15))OPEN cur_fksFETCH NEXT FROM cur_fks INTO @sqlWHILE @@FETCH_STATUS = 0 BEGIN exec (@sql) FETCH NEXT FROM cur_fks INTO @sqlENDCLOSE cur_fksDEALLOCATE cur_fks-- Pray that nr still isn't looking. Create a cursor of -- indexes and statistics, that the field is participating in. -- Loop through and drop indexes/statsDECLARE cur_idx CURSOR FAST_FORWARD READ_ONLY TYPE_WARNINGFOR select distinct i.name, i.status as stat from sysindexkeys k with (nolock) inner join sysindexes i with (nolock ) on k.id = i.id and k.indid = i.indid where k.id = object_id('['+@owner+'].['+@table+']')OPEN cur_idxFETCH NEXT FROM cur_idx INTO @idx_name, @statWHILE @@FETCH_STATUS = 0 BEGIN IF @stat & 64 = 0 -- Actual index (not statistics) BEGIN IF ((@stat & 2048 <>0) OR (@stat & 4096<>0)) --Primary Key or unique key BEGIN SET @sql = 'ALTER TABLE ['+@owner+'].['+@table+'] DROP CONSTRAINT ['+@idx_name+']' END ELSE -- just another index BEGIN SET @sql = 'DROP INDEX ['+@owner+'].['+@table + '].['+@idx_name +']' END END ELSE -- Statistics BEGIN SET @sql = 'DROP STATISTICS ['+@owner+'].['+@table + '].['+@idx_name +']' END exec (@sql) FETCH NEXT FROM cur_idx INTO @idx_name, @statENDCLOSE cur_idx DEALLOCATE cur_idxSET @sql = 'ALTER TABLE ['+@owner+'].['+@table + '] DROP COLUMN [' + @col + ']'EXEC (@sql)Edited by - izaltsman on 12/05/2001 16:36:57