There are many ways to drop database forcefully
1) we need to find active process spid and we need kill
2) following query will help to drop database forcefully
IF EXISTS(SELECT 1 FROM sysdatabases WHERE [NAME]='databaseName')
BEGIN
ALTER DATABASE databaseName
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
ALTER DATABASE databaseName
SET MULTI_USER
WITH ROLLBACK IMMEDIATE;
DROP DATABASE databaseName
END
happy coding...
No comments:
Post a Comment