I created a schema in our SQL Server 2012 database called [Auth]
. Then tables and triggers were created as well. Later I was informed that the schema naming standard is lowercase, so it should be [auth]
. I renamed the schema in the database project, and all related references. However, the Schema Compare feature doesn't detect the difference, and isn't renaming the schema.
This affects our Entity Framework objects, as they should be 'auth'
.
Is there a way to make the database project see a case change as a change, and update the database?
Case sensitivity affects database object names and data. It can be set by using the installation time option or the database creation time option. Oracle. Case-sensitive. The case sensitivity affects data only and not database object names.
SQL Server is, by default case insensitive; however, it is possible to create a case sensitive SQL Server database and even to make specific table columns case sensitive. The way to determine a database or database object is by checking its “COLLATION” property and look for “CI” or “CS” in the result.
Keywords in SQL are case-insensitive for the most popular DBMSs. The computer doesn't care whether you write SELECT , select, or sELeCt ; so, in theory, you can write however you like.
Database, table, table aliases and trigger names are affected by the systems case-sensitivity, while index, column, column aliases, stored routine and event names are never case sensitive. Log file group name are case sensitive.
There is an option in the project settings called "Validate Casing on Identifiers" which according to the documentation shall detect difference in case. However, it only seems to be relevant if you select a case sensitive collation in the Database Settings of your project.
Once I selected SQL_Latin1_General_CP1_CS_AS I was able to detect the changes in a schema name and it scripts the DROP/CREATE schema as expected:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With