Drop multiple databases in SQl Azure -
i run script drop multiple databases sql azure finish using it. when tried following,
declare @dbname varchar(100); declare @stmt nvarchar(3000); set @dbname = '6a732e0b'; select @stmt = (select 'drop database [' + name + ']; ' sys.databases name '%' +@dbname +'%'); exec sp_executesql @stmt;
sql azure throws error message “the drop database statement must statement in batch” can me on this?
this known limitation in sql azure - statements need in batch executed. includes create/alter database, alter database , few more.
to solve problem, can create loop in application iterate on databases , drop them issuing drop database statements in separate batches.
Comments
Post a Comment