--Drop previous reporting database
----------------------------------------------------------
PRINT 'Check if DB exists if so drop'
GO
IF EXISTS(SELECT * FROM SYS.DATABASES WHERE NAME='ReportDB')
BEGIN
--Remove any connections
ALTER DATABASE ReportDB
SET SINGLE_USER WITH
ROLLBACK IMMEDIATE
--Drop DB
DROP DATABASE ReportDB
END
GO
setting db in single user mode can kill you .
there are chances,that after putting db in single user mode,one of your application session can act as single user and you will not get access to database.
Also why you are dropping database , use REPLACE option instead.
-----------------------------------------------------------------------------
संकेत कोकणे