Search code examples
sql-serversql-server-2008encryptionencryption-asymmetricsql-grant

Incorrect syntax near 'TO'. Expecting DOUBLECOLON


I'm trying to grant access to to use an asymmetric key a database user.

GRANT VIEW DEFINITION ON ASYMMETRIC KEY ak TO dbuser

SSMS highlights TO with the following error

Incorrect syntax near 'TO'. Expecting DOUBLECOLON.

What does this mean? How do I fix it?


Solution

  • Did you read MSDN?

    GRANT VIEW DEFINITION ON ASYMMETRIC KEY :: ak TO dbuser
    

    You need the :: for most non-standard-SQL objects in some commands, especially GRANT