microsoft / microsoft/sqlmanagementobjects
SMO.Server.KillDatabase() throws when targeting a SQL Azure Managed Instance server
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 143
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
Repro:
var sc3 = new SqlConnection(@"Data Source=<your MI server>;User ID=sa; Password=...");
var srvconn3 = new ServerConnection(sc3);
var server3 = new SMO.Server(srvconn3);
var db3 = new SMO.Database(server3, "MatteoT_1");
db3.Create();
server3.KillDatabase(db3.Name);
Result
Runtime exception: This ALTER DATABASE statement is not supported. Correct the syntax and execute the statement again.
It looks like we are tripping over the attempt to put the DB in single user mode:
ALTER DATABASE [MatteoT_1] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at SMO.Server.KillDatabase() and reproduce the failure against a SQL Azure Managed Instance using the supplied example. Trace the generated ALTER DATABASE statement, especially the SINGLE_USER clause; done means KillDatabase completes for the MI target without the unsupported-syntax exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100