Guide
Migrating Layers to New Databases
Contact DeLorme Professional Sales for support: 1-800-293-2389 Page 92
--Change this line to contain the type of openspace file you would like generated.
--This parameter is ignored if you are not exporting to the openspace format.
SET @OpenspaceType = 'XMap7'
--Adjust the WHERE clause if you do not want to export/import all layers in the database.
DECLARE LayerCursor CURSOR FOR SELECT ID,Name FROM Layers --WHERE ID IN (1,2,3,4)
OPEN LayerCursor
FETCH NEXT FROM LayerCursor INTO @LayerID, @LayerName
WHILE @@FETCH_STATUS = 0
BEGIN
SET @ExportFileName = '"'+@ExportDirectory+@LayerName+'_'+CAST(@LayerID as
varchar(16))+@ExportExtension+'"'
SET @BatchLine = @ExportProgramPath + ' --source-server=' + @ExportServer + ' --source-
db=' + DB_NAME() +
' --layer='+ CAST(@LayerID as varchar(16)) + ' --output-file='+@ExportFileName
IF @ExportExtension LIKE '%openspace%'
BEGIN
SET @BatchLine = @BatchLine + ' --openspace='+@OpenspaceType
END
PRINT @BatchLine
SET @BatchLine = @ImportProgramPath + ' --target-server=' + @ImportServer + ' --target-db='+
@ImportDatabase +
' --layer-name="'+@LayerName + '" --source-file='+@ExportFileName
PRINT @BatchLine
FETCH NEXT FROM LayerCursor INTO @LayerID, @LayerName
END
CLOSE LayerCursor
DEALLOCATE LayerCursor










