Skip to content

Commit

Permalink
Check for SQL Server VIEW DEFINITION rights fails, if databasename co…
Browse files Browse the repository at this point in the history
…ntains special chars

fixes dotnet#29610
  • Loading branch information
ErikEJ committed Nov 18, 2022
1 parent 8fdc756 commit 1a7a297
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private void CheckViewDefinitionRights(DbConnection connection)
{
using var command = connection.CreateCommand();
command.CommandText = @"
SELECT HAS_PERMS_BY_NAME(DB_NAME(), 'DATABASE', 'VIEW DEFINITION');";
SELECT HAS_PERMS_BY_NAME('[' + DB_NAME() + ']', 'DATABASE', 'VIEW DEFINITION');";
var hasAccess = (int)command.ExecuteScalar()!;

if (hasAccess == 0)
Expand Down

0 comments on commit 1a7a297

Please sign in to comment.