Which Of The Following Is Used To View And Print The Data In A Database?
This browser is no longer supported.
Upgrade to Microsoft Border to accept advantage of the latest features, security updates, and technical back up.
Display data and log infinite information for a database
Applies to: SQL Server (all supported versions) Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)
This commodity describes how to display the data and log space data for a database in SQL Server 2019 (15.x) by using SQL Server Management Studio or Transact-SQL.
Before you begin
Permission to run sp_spaceused is granted to the public role. Only members of the db_owner fixed database role can specify the @updateusage parameter.
Using SQL Server Direction Studio
To display data and log space data for a database
-
In Object Explorer, connect to an example of SQL Server and and then aggrandize that instance.
-
Expand Databases.
-
Correct-click a database, point to Reports, point to Standard Reports, and then select Deejay Usage.
Using Transact-SQL
To display data and log space information for a database by using sp_spaceused
-
Connect to the Database Engine.
-
On the Standard toolbar, select New Query.
-
Paste the post-obit example into the query window and so select Execute. This example uses the sp_spaceused organisation stored procedure to study disk space data for the unabridged database, including tables and indexes.
Employ AdventureWorks2012; Go EXEC sp_spaceused; GO
To display information space used, past object and allocation unit, for a database
-
Connect to the Database Engine.
-
On the Standard toolbar, select New Query.
-
Paste the following example into the query window and and so select Execute. This case queries object catalog views to report disk space usage per table and within each table per allocation unit of measurement.
SELECT t.object_id, OBJECT_NAME(t.object_id) ObjectName, sum(u.total_pages) * 8 Total_Reserved_kb, sum(u.used_pages) * 8 Used_Space_kb, u.type_desc, max(p.rows) RowsCount FROM sys.allocation_units u Join sys.partitions p on u.container_id = p.hobt_id Bring together sys.tables t on p.object_id = t.object_id GROUP By t.object_id, OBJECT_NAME(t.object_id), u.type_desc Gild By Used_Space_kb desc, ObjectName;
To display data and log space information for a database by querying sys.database_files
-
Connect to the Database Engine.
-
On the Standard toolbar, select New Query.
-
Paste the following example into the query window then select Execute. This example queries the sys.database_files catalog view to render specific information about the data and log files in the AdventureWorks2012 database.
Utilise AdventureWorks2012; Go SELECT file_id, name, type_desc, physical_name, size, max_size FROM sys.database_files; GO
See besides
SELECT (Transact-SQL)
sys.database_files (Transact-SQL)
sp_spaceused (Transact-SQL)
Add data or log files to a database
Delete data or log files from a database
Feedback
Submit and view feedback for
Which Of The Following Is Used To View And Print The Data In A Database?,
Source: https://docs.microsoft.com/en-us/sql/relational-databases/databases/display-data-and-log-space-information-for-a-database
Posted by: mcconnellthentell.blogspot.com
0 Response to "Which Of The Following Is Used To View And Print The Data In A Database?"
Post a Comment