Search code examples
c#databasesql-server-2000dbo

SQL Server 2000 - Programmatically Limit Access to Database Owner?


How would I programmatically go about limiting the access of a database in SQL Server 2000 to the database owner for that database? Example... if I right-click "Properties" on the "Northwind" database in Enterprise Manager, the Owner is listed as sa. How would I limit access for this database to just the sa login?


Solution

  • You could set the database to RESTRICTED_USER availability.

    ALTER DATABASE MyDatabase SET RESTRICTED_USER
    
    -- OR --
    
    ALTER DATABASE MyDatabase SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE