Browse by Tags

All Tags » tsql » system
  • TSQL to generate GRANT statements from a database

    select p . state_desc + ' ' + p . permission_name + ' OBJECT::' + s . name collate Latin1_general_CI_AS + o . name collate Latin1_general_CI_AS + ' TO ' + u . name collate Latin1_general_CI_AS + 'GO' , p .* from sys.database_permissions p inner join sys.objects o on p . major_id = o . object_id inner join sys.schemas s on s . schema_id = o . ...
    Posted to SQL Server Aggregator (Weblog) by Anonymous on August 17, 2007
  • TSQL methods to display the owner of schema in a database.

    You can use 2 methods to get information about owner of a particular schema or set of schema(s) within the database. Using INFORMATION_SCHEMA views method (which I prefer most of the times): USE <DBName> GO SELECT * FROM INFORMATION_SCHEMA.SCHEMATA Using query against system catalog: SELECT s.name AS 'Schema Name', db.name AS 'Database User ...
    Posted to SQL Server Aggregator (Weblog) by Anonymous on August 15, 2007