debugsqlMinor
Unable to open database properties window in SSMS
Viewed 0 times
ssmspropertiesopenunabledatabasewindow
Problem
I am using
Question: What could be cause of this error and how can we fix it?
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, , >= or when the subquery is used as an expression. (Microsoft SQL Server, Error: 512)
Azure SQL MI. Using SSMS, I backed up an SQL db to an Azure container. After that I am unable to open the Properties windows of that database using SSMS. When I right click on the database and click on Properties menu, I get the following error. I see the similar error online here but those links have different cause for the error.Question: What could be cause of this error and how can we fix it?
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, , >= or when the subquery is used as an expression. (Microsoft SQL Server, Error: 512)
Solution
I ran into the same problem. The issue is in the msdb database, the backupset table has multiple entries for the same database, when the query SSMS is running only expects one. Run this query to find the duplicates.
You'll need to delete the backup history for the duplicates, which are created when you take a backup, as opposed to the ones SQL MI creates. The MI generated backups will have
That will cure the problem.
SELECT DB_ID(database_name) AS [db_id(database_name)], database_name , backup_start_date, machine_name
FROM msdb..backupset WHERE [type] = 'D' ORDER BY 1,2You'll need to delete the backup history for the duplicates, which are created when you take a backup, as opposed to the ones SQL MI creates. The MI generated backups will have
database_names that look like GUIDs. Do not delete them! Run this code to get rid of yours.EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'your_db_name'That will cure the problem.
Code Snippets
SELECT DB_ID(database_name) AS [db_id(database_name)], database_name , backup_start_date, machine_name
FROM msdb..backupset WHERE [type] = 'D' ORDER BY 1,2EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'your_db_name'Context
StackExchange Database Administrators Q#319735, answer score: 3
Revisions (0)
No revisions yet.