Generic Export to csv script
A generic way to export a table to csv.
A generic way to export a table to csv.
Use the following query to find the size of a table including its indexes and LOBs.
It is useful to be able to see all indexes on a table. There is the shipped stored procedure sp_helpindex but the following query can reveal some more inforamtion such as the Included and Filter columns.
The batch below will reveal all the information you want for the log files of the databases in current instance. Recovery model, location, size, used log, disk available on log file disk, last log backup, log size since last log…
The following statement returns the size of all databases in current SQL Server instance in Megabytes. Information is separated in data and log information.
Creating a Primary Key in SQL Server, by default creates a Clustered Index. The following statement shows all Primary Keys in current database that are using nonclustered indexes instead of clustered. This might not be necessarily wrong, as a clustered…
DECLARE @BRPS BIGINTSELECT @BRPS=cntr_valueFROM sys.dm_os_performance_countersWHERE counter_name LIKE ‘Batch Requests/sec%’WAITFOR DELAY ‘000:00:01’SELECT (cntr_value-@BRPS) AS “Batch Requests/sec”FROM sys.dm_os_performance_countersWHERE counter_name LIKE ‘Batch Requests/sec%’