DECLARE @au_lname VARCHAR(40),--表名
DECLARE @SQLString NVARCHAR(500)
DECLARE tb CURSOR FOR
SELECT name FROM sysobjects WHERE xtype='U'
OPEN tb
FETCH NEXT FROM tb INTO @au_lname
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM tb INTO @au_lname
SET @SQLString='DROP TABLE '+ @au_lname
EXEC sp_executesql @SQLString
END
CLOSE tb
DEALLOCATE tb