Category=Database Maintenance
Name=07.1. Migrate- Index Data to BiblicalContent of New Data Model
Description=Grabs data from current VMR tables and imports it to populate the BiblicalContent table

Heading=Import Index Data Into BiblicalContent

OutputLevel=1
Import2LSQL=SELECT DOCUMENTID from DOCUMENT|	\
SELECT DISTINCT '{0}',	\
lfNr PAGEID,	\
(SELECT 2000000000 + (floor(begAdr/10000)*1000000) + (floor(begAdr/100%100)*1000) + begAdr%100),	\
(SELECT 2000000000 + (floor(endAdr/10000)*1000000) + (floor(endAdr/100%100)*1000) + endAdr%100),	\
coalesce((SELECT INSTITUTIONID FROM INSTITUTION WHERE NAME=inst), 49) INSTITUTIONID,	\
abbr USERID	\
		\
from cont{0} WHERE begAdr is not null and begAdr > 10100 and endAdr is not null and endAdr > 10100 order by lfNr|	\
[v{2}..{3}]INSERT INTO BIBLICALCONTENT (	\
		\
VERSE,			\
DOCUMENTID,			\
PAGEID,			\
INSTITUTIONID,			\
USERID			\
	\
) VALUES ({0}, {1}, {2}, {5}, '{6}')

IgnoreException=Error Code: 1146
