Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

SELECT * FROM sys.databases

Posted on 2013-01-16
7
Medium Priority
?
1,300 Views
Last Modified: 2013-01-16
In running the query below, does the resulting list of databases mean that each database on a SQL server has a table which lists the other co-located databases? Or, is this query actually getting data external to the database itself?

SELECT * FROM sys.databases

Thank you!
JohnD
0
Comment
Question by:johndarby
7 Comments
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 200 total points
ID: 38784684
its actually fetching the data from 'sys' views;
0
 
LVL 40

Expert Comment

by:lcohan
ID: 38784689
"Contains one row per database in the instance of Microsoft SQL Server."


http://msdn.microsoft.com/en-us/library/ms178534(v=sql.100).aspx
0
 
LVL 23

Assisted Solution

by:Steve Wales
Steve Wales earned 400 total points
ID: 38784705
For further reading on the sys.* views, you may also want to check out:

http://msdn.microsoft.com/en-us/library/ms174365
http://msdn.microsoft.com/en-us/library/ms177862

sys.databases isn't actually a table, it's a system view and what you can see in it depends upon your security on the user you're running the query as
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:johndarby
ID: 38784732
Thank you, each! I am feeling a bit dense here...WHERE is the (meta)data stored? In the MASTER DB?
0
 
LVL 1

Author Comment

by:johndarby
ID: 38784775
lcohan, I se your answer, and from whence you quoted the line, but it seems odd that each SQL Server DB would have one row of system data inscribed into each?
0
 
LVL 40

Accepted Solution

by:
lcohan earned 1400 total points
ID: 38784817
Yes is in a master DB table hidded since 2005 and up so they can't be modified anymore. One Row per each database indeed and they are inserted at db creation time. Mode details in select * from sys.database_files for each physical file - just run the query inside each db on that server.
0
 
LVL 1

Author Closing Comment

by:johndarby
ID: 38784916
Thank you for the splendid education! :)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we’ll look at how to deploy ProxySQL.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question