SQL 2005 Get Roles, Schemas & Object Permissions

  • Comments posted to this topic are about the item SQL 2005 Get Roles, Schemas & Object Permissions

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Hey Brandie, thanks for posting the code.

    Jack Corbett
    Consultant - Straight Path Solutions
    Check out these links on how to get faster and more accurate answers:
    Forum Etiquette: How to post data/code on a forum to get the best help
    Need an Answer? Actually, No ... You Need a Question

  • Thanks for the code

    I think you missed the @DBName declaration at the top

    Declare @sqlstmt varchar(5000);

    declare @DBName sysname;

    set @DBName = DB_NAME()

    set @sqlstmt = 'use ['+@DBName+']' + char(10)

    SQLServerNewbie MCITP: Database Administrator SQL Server 2005
  • DOH! Good catch, Jerry. I was so busy trying to make sure I didn't post code w/o permission that I must have accidently dropped that declare statement.

    My bad. :blush:

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • brandie, a bit late perhaps but as you ask in the code column level permissions are in the minor_id column in sys.database_permissions

    If minor_id = 0 its not a column level permissions else it can be derived thus

    col_name(sys.database_permissions.major_Id, sys.database_permissions.minor_id)

    ---------------------------------------------------------------------

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply