crackyourinterview.com


To improves our performance please Like Share Subscribe(Will boost us)

How to obtain list of all schemas in SQL Server Database?
Question Posted on 10 Mar 2024Home >> 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



.


Most Visited Questions:-

Deep Learning Questions Answers
Below are the different Deep Leaning Questions and answer a More...

Continuous Integration Questions Answers
Below are the 20 odd questions for CI or Continuous Integra More...

Derived relationships in Association Rule Mining are represented in the form of __________.
Derived relationships in Association Rule Mining are repres More...

What is Gulpjs and some multiple choice questions on Gulp
Gulpjs is an open source whihc helps in building Javascript More...

Microservices Architecture Questions Answers
Below are the different questions on Microservices Architec More...




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






@2014-2022 Crackyourinterview (All rights reserved)
Privacy Policy - Disclaimer - Sitemap