create Procedure DropDatabase
@a int = 0
as
Declare @SqlStmt nvarchar(125)
declare @dbName nvarchar(25)
if @a>0
begin
select @dbName = DatabaseName from xx.dbo.xyz where RecId = @a
if @dbName is not NULL
begin
set @sqlStmt = 'Use Master;Drop Database '+ @dbName
exec sp_executeSql @sqlStmt
end
end
My procedure is not dropping database. I am getting databasename from another database
@a int = 0
as
Declare @SqlStmt nvarchar(125)
declare @dbName nvarchar(25)
if @a>0
begin
select @dbName = DatabaseName from xx.dbo.xyz where RecId = @a
if @dbName is not NULL
begin
set @sqlStmt = 'Use Master;Drop Database '+ @dbName
exec sp_executeSql @sqlStmt
end
end
My procedure is not dropping database. I am getting databasename from another database