28 May 2024

MS SQL Server - Select Database

 Select your database based on your action before going ahead with any of the following methods.

Method 1 – Using SQL Server Management Studio

Example

To run a query to select backup history on database called ‘msdb’, select the msdb database as shown in the following snapshot.

Select Database

Method 2 – Using T-SQL Script

Use <your database name>

Example

To run your query to select backup history on database called ‘msdb’, select the msdb database by executing the following query.

Exec use msdb

The query will open msdb database. You can execute the following query to select backup history.

Select * from backupset

No comments:

Post a Comment

👉 “Why Your SQL LEFT JOIN Is Creating Duplicate Rows (And How to Fix It Fast)”

  🚨 Problem (Relatable Hook) You wrote a simple LEFT JOIN … But suddenly your data is duplicated 😵 👉 Example: Expected: 100 rows ...