February 2019

T-SQL-Commands

T-SQL: List transactions & log used

The code below will list the transactions on the instance, and it will also include the size of the log which is used for that transaction.The output is ordered by log size. You can also use the below to find…

Read More
T-SQL-Commands

T-SQL: Check progress of backup/restore

Backups/restores can take a lot of time, but when it’s running, you want so see the progress.By executing the handy T-SQL code below, you can see the progress of the backups/restores on your system.

Read More
T-SQL-Commands

T-SQL: Remap SQL users

If you copy (backup/restore) a database from system A to system B, it is possible that the SQL users won’t be able login and this because the GUID/SID of the users on system A doesn’t match the GUID/SID of system…

Read More
T-SQL-Commands

T-SQL: Flush memory cache for testing purposes

SQL server is of course caching data, in order to minimize access to disks. Sometimes you want to clear that memory, for testing purposes for example. You can use DBCC commands in order to clear the system / proc /…

Read More
T-SQL-Commands

T-SQL: Creation date/time of tables

When you are looking for the creation date/time of certain tables, you can easily find that in the sys.tables.You can use the code below in order to list all tables, and the creation date of those tables.

Read More
T-SQL-Commands

T-SQL: Find table in complete instance

Looking for a table, but you don’t remember in which database it’s located? The code below will create a stored procedure, which you can use in order to find a table in multiple databases.

Read More
T-SQL-Commands

T-SQL: Kill all connections to a specific database

Sometimes you need to do maintenance on a database, and you don’t really want to use single user mode or disable accounts. In that situation you could kill all connections to a specific database.In order to achieve that, you can…

Read More