Home > database >  Ask teachers and find out the user permissions list how to put the tree into a horizontal table?
Ask teachers and find out the user permissions list how to put the tree into a horizontal table?

Time:09-21

Such as my info table with aaa and BBB two accounts, have insert and select permissions
Sp_helprotect info
It shows my account permissions list
Object name account name authority
The info aaa insert
The info aaa select
The info BBB insert
The info BBB select

Is there a way to let it show like this?
Object name account name insert permissions select permissions
The info aaa insert select
The info BBB insert select

CodePudding user response:

Is there a teacher can teach, thank you

CodePudding user response:

SELECT [object name], [name] accounts, SELECT the AS/SELECT permissions, insert the AS [insert permissions]
The FROM
(
SELECT [object], [account name], [access]
The FROM account permissions list
) S

The PIVOT (MAX ([account]) FOR [access] IN (' select ', 'insert') P

CodePudding user response:

SELECT [object], [account name], [SELECT] AS [SELECT permissions], [insert] AS [insert permissions]
The FROM
(
SELECT [object], [account name], [access]
] FROM [account permission list
) S

The PIVOT (MAX ([account]) FOR [access] IN (' select ', 'insert')) P

CodePudding user response:


A red line of code attempts to plug in, results suggest, is my name in error? How to plug in?

CodePudding user response:

You use the name of the column of the SELECT and INSERT are SQL KEYWORD, error is normal, isn't he RUN a try,
  • Related