Partilhar via


Other Statements (Transact-SQL)

Microsoft SQL Server 2005 provides the following new and enhanced statements and commands that can be used for database administration and error handling.

New Statements

Statement Description

RESTORE REWINDONLY

Rewinds and closes specified tape devices that were left open by BACKUP or RESTORE statements executed with the NOREWIND option.

TRY…CATCH

Used to handle transaction abort errors.

EXECUTE AS

Sets the execution context of a session or user-defined module such as a stored procedure, trigger, queue, or user-defined function.

Enhanced Statements

Statement Description

BACKUP

Supports optional partial backups (of the primary filegroup and any read/write secondary filegroups), creating copy-only backups outside the typical sequence of backups, mirroring of backup media (mirrored media sets), creating backup checksums, and continuing despite errors.

CHECKPOINT

Enhanced to try to perform a checkpoint in a specified period of time.

EXECUTE

Enhanced to support pass-through commands to linked servers and to set the execution context of the session.

OPENROWSET

Enhanced with a BULK option that uses the BULK rowset provider for OPENROWSET to read data from a data file without loading the data into a target table. You can use OPENROWSET with a simple SELECT statement, and also with an INSERT statement.

RESTORE and RESTORE VERIFYONLY

Supports optional online restore, page restore, piecemeal restore of filegroups, mirrored media sets, using backup checksums (if present in a backup), and continuing despite errors.

RESTORE DATABASE supports reverting a database to a database snapshot and supports the STOPAT option.

RESTORE LOG can now include a file list.

RESTORE VERIFYONLY checks are enhanced.

RESTORE HEADERONLY

Returns new flags to indicate whether the backup contains checksums.

RESTORE LABELONLY

Returns a new column, Mirror_Count, to support mirrored media sets.

RESTORE VERIFYONLY (Transact-SQL)

Now supports optionally displaying a message every time another percentage finishes.

RAISERROR

Enhanced to raise a transaction abort error.

See Also

Other Resources

What's New and Enhanced in Transact-SQL (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance