Export (0) Print
Expand All
Expand Minimize
1 out of 1 rated this helpful - Rate this topic

sp_can_tlog_be_applied (Transact-SQL)

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

Topic link iconTransact-SQL Syntax Conventions

sp_can_tlog_be_applied [ @backup_file_name= ] 'backup_file_name', [ @database_name= ] 'database_name', [ @result= ] resultOUTPUT
[ @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;
GO
DECLARE @MyBitVar BIT;
EXEC sp_can_tlog_be_applied
     @backup_file_name = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Backup\AdventureWorks.bak',
     @database_name = N'AdventureWorks',
     @result = @MyBitVar OUTPUT;
GO
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.