Hi Guest

MobileUser

1 HomePage 1 Jobs 1 WalkIn 1Articles  

Cat Exam

 :) Latest Topic
AJAX
VB.NET
SQL Query
UDDI
CLASS
JavaScript Questions
SharePoint Interview
SilverLight
WCF
general knowledge
 ASP.NET
 :) Hot Jobs
 
 :) Latest Articles


  

 


How to obtain list of all schemas in SQL Server Database?
Question Posted on 10 Mar 2024

Home >> DataBase >> SQL Query >> How to obtain list of all schemas in SQL Server Database?




How to obtain list of all schemas in SQL Server Database?
To retrieve a list of all schemas in the given Sql Server database. We use below different queries:-

(1)SELECT name FROM sys.schemas
SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA

(2)SELECT * FROM INFORMATION_SCHEMA.SCHEMATA

(3)SELECT * FROM sysusers WHERE gid <> 0

(4)SELECT s.name + '.' + ao.name, s.name
FROM sys.all_objects ao
INNER JOIN sys.schemas s ON s.schema_id = ao.schema_id
WHERE ao.type='u';

(5)select s.schema_id, s.name as schema_name from sys.schemas s
inner join sys.sysusers u on u.uid = s.principal_id
where u.name='DataBaseUserUserName' order by s.name

(6)SELECT s.name AS schema_name,u.name AS schema_owner
FROM sys.schemas s INNER JOIN sys.sysusers u ON u.uid = s.principal_id
ORDER BY s.name;
0
0



 
 Input Your Comments Or suggestions(If Any)
 Name
 Email(optional)
 Comments


Other Important Questions
How to get the table count in last used query from cache by sending tablename?
Write a SQL query to print 1 to 100 in sql server?
Sql Interview Latest Query questions asked on 30 dec 2020
nth highest number from table
some good sql query






 
Top Searches:asp net questions vb net questions sql query uddl questions class javascript Questions sharepoint interview questions and concept silverlight questions and concept wcf questions beans general knowledge ajax questions
PHP | Biztalk | Testing | SAP | HR |