SSMS 18.9.2 bug in Data Compression Wizard - calculate

Erik van de Burgwal 1 Reputation point

SSMS: Select Table (right click) > Storage > Manage Compression > Next > Page > Calculate
When the database-name contains character - , the button will not execute the calculation because the SQL generated does not escape the database name properly;

USE u-test
Database 'u' does not exist. Make sure that the name is entered correctly.

Verified in SSMS 18.9.2

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,069 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. ErickMarcia 1 Reputation point

    Prueba con [u-test]
    Nota: Para evitar este tipo de problema entre las mejores prácticas de desarrollo de base de datos, se recomienda no hacer uso de guiones "-".

    Try with [u-test]
    Note: To avoid this type of problem among the best database development practices, it is recommended not to use hyphens "-".

    0 comments No comments

  2. YufeiShao-msft 7,076 Reputation points

    Hi @Erik van de Burgwal

    Whether you want to create table or database, you cannot use '-' directly to create it successfully, because '-' belongs to the operator and does not comply with rules for T-SQL identifiers.
    The identifies that do not comply with these rules must be delimited by double quotation marks or brackets.

    create database [u-test]  

    after the database has been created, the database name will not display double quotation marks or brackets, but when using the T-SQL, you need to add these symbols. Like this:

    use [u-test]  

    An error will be reported when performing these steps as you have described:

    An exception occurred while executing a Transact-SQL statement or batch.  
    Database 'u' does not exist. Make sure that the name is entered correctly. (Microsoft SQL Server, Error: 911)  

    The error shown in the additional information is the error that occurred when double quotation marks or brackets are not added. The UI does not recognize that the database used actually contains these symbols.

    It is recommended not to use identifiers that do not comply with the rules, because it may cause more trouble in practice