Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
naveen3234
Starting Member
2 Posts |
Posted - 2015-02-18 : 20:42:18
|
hai friends,i am new to this forum.can any body tell me how to find the names of the tables owned by the particular user in sql server and how to display the distinct object types owned by the particular userthanks |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2015-02-19 : 00:32:14
|
[CODE];with objects_cte as( select o.name, o.type_desc, case when o.principal_id is null then s.principal_id else o.principal_id end as principal_id from sys.objects o inner join sys.schemas s on o.schema_id = s.schema_id where o.is_ms_shipped = 0 and o.type in ('U') -- 'FN', 'FS', 'FT', 'IF', 'P', 'PC', 'TA', 'TF', 'TR', 'V'))select cte.name, cte.type_desc, dp.namefrom objects_cte cteinner join sys.database_principals dpon cte.principal_id = dp.principal_idwhere dp.name = 'YourUser';[/CODE]--Chandu |
|
|
|
|
|
|
|