use master declare @dbname sysname set @dbname='UFidaT3HR_PuJi_0002' declare @s nvarchar(1000) declare tb cursor local for select s='kill '+cast(spid as varchar) from master..sysprocesses where dbid=db_id(@dbname) open tb fetch next from tb into @s while @@fetch_status=0 begin exec(@s) fetch next from tb into @s end close tb deallocate tbif exists(select 1 from sysdatabases where name=@dbname)exec('drop database ['+@dbname+']')
上面这段sql语句是删除数据库的,在sql2000和sql2005中运行都是正常的,但是在sql2008中就有问题,求高人解答。在线等
他提示的错误是,会终止用户进程。 然后再删除一遍就好了。这是什么原因??