Ms Sql Server 简明教程

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

要在一个名为“msdb”的数据库上运行查询以选择备份历史记录,请选择 msdb 数据库,如下面的快照所示。

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

要在一个名为“msdb”的数据库上运行查询以选择备份历史记录,通过执行以下查询选择 msdb 数据库。

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

Exec use msdb

该查询将打开 msdb 数据库。您可以执行以下查询以选择备份历史记录。

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

Select * from backupset