Any suggestions? Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

sp_can_tlog_be_applied (Transact-SQL)


Applies To: SQL Server 2014, SQL Server 2016 Preview

Verifies whether a transaction log backup can be applied to a SQL Server database. sp_can_tlog_be_applied requires that the database be in the Restoring state.

Applies to: SQL Server (SQL Server 2008 through current version).

Topic link icon Transact-SQL Syntax Conventions

sp_can_tlog_be_applied [ @backup_file_name = ] 'backup_file_name', [ @database_name = ] 'database_name', [ @result = ] result OUTPUT

[ @backup_file_name = ] 'backup_file_name'

Is the name of a backup file. backup_file_name is nvarchar(128).

[ @database_name = ] 'database_name'

Is the name of the database. database_name is sysname.

[ @result = ] result OUTPUT

Indicates whether the transaction log can be applied to the database. result is bit.

1 = The log can be applies

0= The log cannot be applied.

0 (success) or 1 (failure)

Only members of the sysadmin fixed server role can execute sp_can_tlog_be_applied.

The following example declares a local variable, @MyBitVar, to store the result.

USE master;
EXEC sp_can_tlog_be_applied
     @backup_file_name = 
N'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\AdventureWorks2012.bak',
     @database_name = N'AdventureWorks2012',
     @result = @MyBitVar OUTPUT;

Community Additions

© 2016 Microsoft