Real-time Geodatabase Replication? Part 6

212
0
01-24-2015 12:26 PM
Labels (1)
MVP Frequent Contributor
2 0 212

In Real-time Geodatabase Replication? Part 1 you were introduced to SQL Real-Time Replication. One requirement of SQL Merge Replication is that the table being replicated must have a rowguidcol. This is easy with a cursor:

DECLARE

@sql VARCHAR(500),

@tableName VARCHAR(128)

DECLARE gandgCursor CURSOR

FOR

SELECT

table_name

FROM

SDE_column_registry

WHERE

table_name like 'CR%'

ORDER BY

table_name ASC

OPEN gandgCursor

FETCH NEXT FROM gandgCursor 

INTO @tableName

WHILE ( @@FETCH_STATUS = 0 )

BEGIN

SET @sql = '

ALTER TABLE [dbo].['+ @tableName + ']

ALTER COLUMN GlobalID ADD ROWGUIDCOL ;

'

PRINT 'Executing Statement - '+ @sql

EXECUTE ( @sql )

FETCH NEXT FROM gandgCursor 

INTO  @tableName

END

CLOSE gandgCursor

DEALLOCATE gandgCursor

About the Author
This is a personal account and does not reflect the view or policies of my org.