Results 1 to 7 of 7

Thread: how find out if db is readonly or dbo use only with sql

  1. #1
    Join Date
    Sep 2002
    Posts
    159

    how find out if db is readonly or dbo use only with sql

    Hi,

    I have sciprt that assign object
    permissions to all databases.

    I want to exclude all read only and dbo use only databases

    Thank you

    Alex

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Run 'sp_dboption db_name'.

  3. #3
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    select Status=
    CASE Status&1024 WHEN 1024 THEN 'Read Only ' +char(13)+char(10) ELSE '' END+
    CASE Status&2048 WHEN 2048 THEN ' DBO Use only ' +char(13)+char(10) ELSE '' END
    from sysdatabases

  4. #4
    Join Date
    Sep 2002
    Posts
    159
    thank a lot for both solutions

    but what is Status&1024 ?


    Alex

  5. #5
    Join Date
    Sep 2002
    Posts
    5,938
    It performs a bitwise logical AND operation between two integer values.

  6. #6
    Join Date
    Sep 2002
    Posts
    159
    one more question

    I have maintenance plan to reorganize all db , any way to make it run for all db except read only

    thank you

  7. #7
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    I am afraid you have to select databases manually

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •