USE Command in SQL Server
The Use command in SQL Server is a way to change context to a specified database, which I often refer to this as scoping to a database for a query.
The Use command in SQL Server is a way to change context to a specified database, which I often refer to this as scoping to a database for a query.
When you log into SQL Server using SQL Server Management Studio (SSMS), opening a new query window will automatically scope you within the default database set when your user was created.
The Disk Usage by Top Tables Report in SQL Server is a quick way to get sizes of all tables within a database.
Logs are always important if you’re supporting systems. The SQL Server Agent has always been a heavily used tool in my experience, so writing execution trace messages to the logs might help investigate an issue one day.
The Import Flat File wizard within SSMS was introduced in December 2017 (14.0.17213.0). This is a streamlined version of the Import Data feature and it minimises the user intervention during a file import.
SSMS has an option that allows you to change the colour of your query banner, which is useful if you want visually mark a server that you work with every-day.
This post is a quick guide on how to export data from SQL Server into a CSV file. The default export to settings will try save your query as a column aligned .rpt file, so I’ll cover that below while converting to CSV format.
This is a tip on how to show line numbers in your SQL Server Management Studio (SSMS) query window. This can be useful for when you receive an error with reference to a line in your code, although it’s not a necessity having it enabled as you’ll see below.