I am trying to get the list of non-dba accounts who have DDL privileges on user objects. I wrote the below query but seems some thing wrong.
Please corret the below query.
select distinct ltrim(rtrim(@@servername))+","+a.name+","+object_n ame(b.id)+","+"Non DBAs in $db with DDL privileges" from sysusers a, sysprotects b
where b.action in (select number from master.dbo.spt_values where type='T' and number between 198 and 355)
and a.name like "f[0-9][0-9]%" OR name like "c[0-9][0-9]%"
and a.name not in('dba','dbasup','prddba','sa','sybqstcp','c07569 ','c23428','c23618','c23622','f163614','f201197',' f228454','f254567')