Sql Query Notifications

Discussion in 'Databases' started by adhamayman2000, Oct 30, 2010.

  1. I'm Trying To Use SqlCacheDependency .. In Order To Do That .. I Have To Grant Some Permissions To The <database_principal> on the database I created , In SQL Management Studio.
    I Don't Know What Exactly Should Be My <database_principal> , I Tried My Log In as the principal .. but it throws the following exception :
    "Cannot find the user 'DB_15507_testdb_user', because it does not exist or you do not have permission."
    I Was Hoping That You Could Help Me With That , Here Are The Statements I'm Trying To Execute :
    GRANT CREATE PROCEDURE TO <database_principal>
    GRANT CREATE QUEUE TO <database_principal>
    GRANT CREATE SERVICE TO <database_principal>
    GRANT SUBSCRIBE QUERY NOTIFICATIONS TO database_principal
     
  2. rum

    rum Winhost Staff

    DB_15507_testdb_user is not a database principal. It is SQL Server Instance principal or SQL Server login. You cannot grant permissions to server-level principals, so the error message you are getting is fully justified.

    DB_15507_testdb_user is mapped to the database principal, or database user with the name "dbo". This database user is a member of db_owner database role and has ALL permission by default , so you do not have to grant anything. Please exclude all grant statements from your code. What you will need to do before you can use SqlCacheDependency is to enable SQL Server Service Broker. You can do so by executing the T-SQL code below:

    ALTER DATABASE DB_15507_testdb SET enable_broker
    GO
     
    nbearden likes this.

Share This Page