Click here to Skip to main content
15,893,337 members
Home / Discussions / Database
   

Database

 
AnswerRe: Crystal reports 2005 Suppressing page headers when there is a subreport (in the report footer) Pin
Frank Kerrigan8-Oct-08 4:09
Frank Kerrigan8-Oct-08 4:09 
AnswerTry forcing new page Pin
David Mujica20-Oct-08 10:05
David Mujica20-Oct-08 10:05 
QuestionPlace the result to the word Pin
irvinia6-Oct-08 17:48
irvinia6-Oct-08 17:48 
AnswerRe: Place the result to the word Pin
Paul Conrad6-Oct-08 18:40
professionalPaul Conrad6-Oct-08 18:40 
GeneralRe: Place the result to the word Pin
irvinia7-Oct-08 15:53
irvinia7-Oct-08 15:53 
GeneralRe: Place the result to the word Pin
Paul Conrad7-Oct-08 16:34
professionalPaul Conrad7-Oct-08 16:34 
QuestionCreating a View or Restructuring a View? Pin
srferson6-Oct-08 10:10
srferson6-Oct-08 10:10 
AnswerRe: Creating a View or Restructuring a View? Pin
Wendelius6-Oct-08 10:34
mentorWendelius6-Oct-08 10:34 
The readability would be a matter of an opinion Smile | :)

If you set up your results as in your post, you could have one very long row (depending on how many users you have).

Perhaps, you could get a starting point if you take tables as rows and then users for each table with fixed columns as privileges. Something like the following. Then if you like you can start pivoting on tables or users using sub selects in FROM section and modify the structure as you like.

Also notice that you can place FOR XML AUTO at the end of the query, if it makes the results more readable.

select userinfo.Table_Name, 
       userinfo.Grantee ,
       case when selectinfo.GRANTOR is not null then 'Yes' else '' end SelectPermission,
       case when insertinfo.GRANTOR is not null then 'Yes' else '' end InsertPermission,
       case when updateinfo.GRANTOR is not null then 'Yes' else '' end UpdatePermission,
       case when updateinfo.GRANTOR is not null then 'Yes' else '' end DeletePermission
from information_schema.table_privileges as userinfo
     left outer join
     information_schema.table_privileges as selectinfo
     on userinfo.grantee = selectinfo.grantee 
     and userinfo.table_catalog = selectinfo.table_catalog
     and userinfo.table_schema = selectinfo.table_schema
     and userinfo.table_name = selectinfo.table_name
     and selectinfo.PRIVILEGE_TYPE = 'SELECT'
     left outer join
     information_schema.table_privileges as insertinfo
     on userinfo.grantee = insertinfo.grantee 
     and userinfo.table_catalog = insertinfo.table_catalog
     and userinfo.table_schema = insertinfo.table_schema
     and userinfo.table_name = insertinfo.table_name
     and insertinfo.PRIVILEGE_TYPE = 'INSERT'
     left outer join
     information_schema.table_privileges as updateinfo
     on userinfo.grantee = updateinfo.grantee 
     and userinfo.table_catalog = updateinfo.table_catalog
     and userinfo.table_schema = updateinfo.table_schema
     and userinfo.table_name = updateinfo.table_name
     and updateinfo.PRIVILEGE_TYPE = 'UPDATE'
     left outer join
     information_schema.table_privileges as deleteinfo
     on userinfo.grantee = deleteinfo.grantee 
     and userinfo.table_catalog = deleteinfo.table_catalog
     and userinfo.table_schema = deleteinfo.table_schema
     and userinfo.table_name = deleteinfo.table_name
     and deleteinfo.PRIVILEGE_TYPE = 'DELETE'
order by Table_Name, Grantee 


The need to optimize rises from a bad design

AnswerPIVOT query Pin
David Mujica6-Oct-08 10:47
David Mujica6-Oct-08 10:47 
QuestionHow to remove Identity(1,1) property only from column in table in sql server 2000 Pin
trilokharry6-Oct-08 5:05
trilokharry6-Oct-08 5:05 
AnswerRe: How to remove Identity(1,1) property only from column in table in sql server 2000 Pin
Wendelius6-Oct-08 6:59
mentorWendelius6-Oct-08 6:59 
GeneralRe: How to remove Identity(1,1) property only from column in table in sql server 2000 Pin
Frank Kerrigan8-Oct-08 4:10
Frank Kerrigan8-Oct-08 4:10 
GeneralRe: How to remove Identity(1,1) property only from column in table in sql server 2000 Pin
Wendelius8-Oct-08 4:23
mentorWendelius8-Oct-08 4:23 
GeneralRe: How to remove Identity(1,1) property only from column in table in sql server 2000 Pin
Frank Kerrigan8-Oct-08 6:15
Frank Kerrigan8-Oct-08 6:15 
GeneralRe: How to remove Identity(1,1) property only from column in table in sql server 2000 Pin
Wendelius8-Oct-08 6:51
mentorWendelius8-Oct-08 6:51 
GeneralDenormalisation Quandary Pin
Brady Kelly6-Oct-08 3:48
Brady Kelly6-Oct-08 3:48 
GeneralRe: Denormalisation Quandary Pin
Ashfield6-Oct-08 4:35
Ashfield6-Oct-08 4:35 
GeneralRe: Denormalisation Quandary Pin
Brady Kelly6-Oct-08 4:48
Brady Kelly6-Oct-08 4:48 
GeneralRe: Denormalisation Quandary Pin
Ashfield6-Oct-08 5:23
Ashfield6-Oct-08 5:23 
GeneralRe: Denormalisation Quandary Pin
Mark Churchill6-Oct-08 5:32
Mark Churchill6-Oct-08 5:32 
QuestionExecute macro word from sql 2005 Pin
irvinia6-Oct-08 1:24
irvinia6-Oct-08 1:24 
AnswerRe: Execute macro word from sql 2005 Pin
ChandraRam6-Oct-08 2:12
ChandraRam6-Oct-08 2:12 
GeneralRe: Execute macro word from sql 2005 Pin
irvinia6-Oct-08 16:46
irvinia6-Oct-08 16:46 
AnswerRe: Execute macro word from sql 2005 Pin
Wendelius6-Oct-08 7:08
mentorWendelius6-Oct-08 7:08 
GeneralRe: Execute macro word from sql 2005 Pin
irvinia6-Oct-08 16:46
irvinia6-Oct-08 16:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.