Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_cdc_dbsnapshotLSN

  No additional text.


Syntax

create procedure [sys].[sp_cdc_dbsnapshotLSN]
(
	@db_snapshot sysname,
	@lastLSN binary(10) = null output,
	@lastLSNstr varchar(40) = null output
)
as
begin
	declare @command nvarchar(max), @str nvarchar(1000), @begin_char int
		,@lsn binary(10), @lsn_str nvarchar(40), @db_snapshot_quoted nvarchar(1000)
	
	declare @temp table(parentObject nvarchar(255),Object nvarchar(255),field nvarchar(255),value nvarchar(255))
	
	-- Verify that the database snapshot exists
	if not exists (
		select name from sys.databases
		where name = @db_snapshot
		and source_database_id is not null)
	begin
		select @db_snapshot_quoted = quotename(@db_snapshot)
		raiserror(22862, 16, -1, @db_snapshot_quoted)
		return 1
	end		
	
	set @lsn = 0x00
	set @lsn_str = null
	set @command = N'dbcc dbtable(' + quotename(@db_snapshot) + N') with tableresults, no_infomsgs'
	
	insert into @temp exec( @command )
		select @str = value from @temp where field = N'm_splitPoint';
	
	if @str is not null
	begin	
		select @begin_char = CHARINDEX('(', @str)
		select @lsn_str = SUBSTRING(@str, @begin_char + 3, 8) + SUBSTRING(@str, @begin_char + 12, 8)
			+ SUBSTRING(@str, @begin_char + 21, 4)
		select @lsn = sys.fn_cdc_hexstrtobin(@lsn_str)
	end
	
	set @lastLSN = @lsn
	set @lastLSNstr = @lsn_str		

	return 0	
end

 
Last revision 2008RTM
See also

  sp_MSdrop_cdc (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash