Back

Topic

[KB761]Useful SQL Scripts

Tags: MSSqlServer, SQL, SQL Server

10 years ago
By RM
Options
Print
Applies to:

All versions of PcVue


Summary:

Some example SQL scripts useful for troubleshooting.
Originator: NK


Details:

GetDBSize.sql

Script providing information about the space used by the data vs the space allocated.
Result:

ex01

GetNbRosw.sql

Script returning the Rows number according for a table. In the script example the table name is TB_TREND.
Result:

ex02

Note that you can get the same information by right clicking on the table / Properties / Storage.

Checking the time taken for SQL Server to execute one request

Use the following script:

SET STATISTICS TIME ON;
GO
…Here write your request as usual
GO
SET STATISTICS TIME OFF;
GO

After execution SSMS displays the time to execute your request.

Download attachments:


Created on: 15 Apr 2015 Last update: 13 May 2024