Dashboard Shop Ask a question
Log in
Knowledge base

Basic SQL Cheat Sheet

This guide provides a list of common SQL commands to help you quickly verify the status and content of your database. You can execute these commands instantly using the T-SQL Console in your control panel.

1. List All Tables

Use this query to retrieve a list of all user-created tables in your database.

SELECT Name FROM sys.tables ORDER BY Name

2. Check Database Size

Use this stored procedure to see the current size of your database and the space used by data and logs. This is useful for monitoring your hosting plan limits.

EXEC sp_spaceused

3. View Table Row Counts

Use this query to quickly see how many records are in each table. This is an excellent way to verify that your data was imported successfully after a migration.

SELECT t.name AS TableName, p.rows AS RowCount
FROM sys.tables t
JOIN sys.partitions p ON t.object_id = p.object_id
WHERE p.index_id IN (0,1)
ORDER BY t.name

4. Check SQL Server Version

Use this to confirm the specific version and edition of the SQL Server your database is hosted on.

SELECT @@VERSION

5. List Top 10 Records

Replace YourTableName with the actual name of a table to view the first 10 rows of data.

SELECT TOP 10 * FROM YourTableName
© Copyright 2025 Doka management panel