1. The first parameter db_name() is splitting in 4 different entities. This is the way that we could make a reference an object in SQL SERVER (Server.Database.Schema.Object) in OnPremise.
2. In this situation, even when you specify DATABASE as parameter to check, we are splitting as a server name the first part of this value before the dot and database name starting the dot to the end of the text.
3.For this reason, if our customer database name is “My.Database” you are able to obtain the correct value of the permission using one of these different combinations:
3.1.Removing the dot and renaming the database without dot.
3.2.Adding the brackets [] at the beginning and at the end, for example, [My.Database]
3.3.Leaving this value as null, for example, SELECT HAS_PERMS_BY_NAME(Null, 'DATABASE', 'CREATE TABLE').
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.