* from LawInfo NewTables INTO SELECT WHERE = 2. 1 - Copy Table Structure
Delete newTables - deleting data table
drop Table newTables - remove a table and the table structure
Alter table MyTableName Drop constraint constraint names - to delete the table relationships
Alter table MyTableName Drop column field names - Remove table field
Alter the Table MyTableName nocheck constraint A All - disable all constraints
--------- followed by a calf stored procedures, in order to achieve a query table of all foreign key relationships, and delete -----------
code show as below:
Create proc DeleteSingleTable(@tablename varchar(100))
as
begin
declare @SQL varchar(2000)
declare @constraintName varchar(100)
declare curName cursor for
select name from sysobjects
where xtype = 'f ' and parent_obj =
(select [id] from sysobjects where [name]=@tablename and xtype = 'u ')
open curName
fetch next from curName into @constraintName
while @@fetch_status = 0
begin
set @SQL = 'alter table ' + @tablename + ' drop constraint '
set @SQL = @SQL + @constraintName
exec(@SQL)
fetch next from curName into @constraintName
end
close curName
deallocate curName
end