Basic database checkup

Here is some code to determine database health. Use it for Data Pump SQL series projects.

USE ASI2353;
--
/* Do the basic check */
DBCC checkdb('ASI2353');
--
/*  See file sizes */
SELECT name, size, maxsize from sysfiles;
--
/* See the percentage of used files */
DBCC Updateusage ('ASI2353');
EXEC sp_spaceused;
--
/*  See free space on transaction log */
DBCC SQLPerf (LogSpace);
--
/* See if there is an open transaction */
DBCC OpenTran ('ASI2353');
--
/* See index fragmentation */
DBCC ShowContig (PartData) with ALL_INDEXES;

Listing fields

To inspect field table on the Data Pump SQL series.

/* Show all fields and properties */
USE ASI2353;
SELECT * 
    FROM [dbo].[Field]
    WHERE [Name] IS NOT NULL
ORDER BY [Position];
-–
/* Show fields which have units */
USE ASI2353;
SELECT [Name], [Unit]
    FROM [dbo].[Field]
    WHERE [Name] IS NOT NULL 
        AND [Unit] IS NOT NULL 
ORDER BY [Position];
-–
/* Show all measurement fields */
USE ASI2353;
SELECT [Name], [Unit]
    FROM [dbo].[Field]
    WHERE [Name] IS NOT NULL 
        AND [IsMeasurement] = 1 
ORDER BY [Position];
-–
/* Show all result fields */
USE ASI2353;
SELECT [Name]
    FROM [dbo].[Field]
    WHERE [Name] IS NOT NULL 
        AND [IsResult] = 1 
ORDER BY [Position];

See more about the fields in the knowledge database.