Advertisement
Guest User

sag.sql

a guest
Aug 2nd, 2023
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 316.31 KB | Source Code | 0 0
  1. CREATE SCHEMA sageimport;
  2.  
  3.  
  4. CREATE TABLE sageimport.rap_analysis(
  5. companycode varchar(3)
  6. , lastupdatedate date
  7. , period1endingdate date
  8. , period2endingdate date
  9. , period3endingdate date
  10. , period4endingdate date
  11. , period5endingdate date
  12. , period6endingdate date
  13. , currentnoofinvs numeric(15,4)
  14. , currenttotalpayables numeric(15,4)
  15. , currentover30days numeric(15,4)
  16. , currentover60days numeric(15,4)
  17. , period1noofinvs numeric(15,4)
  18. , period1totalpayables numeric(15,4)
  19. , period1over30days numeric(15,4)
  20. , period1over60days numeric(15,4)
  21. , period2noofinvs numeric(15,4)
  22. , period2totalpayables numeric(15,4)
  23. , period2over30days numeric(15,4)
  24. , period2over60days numeric(15,4)
  25. , period3noofinvs numeric(15,4)
  26. , period3totalpayables numeric(15,4)
  27. , period3over30days numeric(15,4)
  28. , period3over60days numeric(15,4)
  29. , period4noofinvs numeric(15,4)
  30. , period4totalpayables numeric(15,4)
  31. , period4over30days numeric(15,4)
  32. , period4over60days numeric(15,4)
  33. , period5noofinvs numeric(15,4)
  34. , period5totalpayables numeric(15,4)
  35. , period5over30days numeric(15,4)
  36. , period5over60days numeric(15,4)
  37. , period6noofinvs numeric(15,4)
  38. , period6totalpayables numeric(15,4)
  39. , period6over30days numeric(15,4)
  40. , period6over60days numeric(15,4)
  41. , totalnoofdaysold numeric(15,4)
  42. , totaloforiginalinvamounts numeric(15,4)
  43. , dateupdated date
  44. , timeupdated varchar(8)
  45. , userupdatedkey varchar(10)
  46. , CONSTRAINT rap_analysis_KEY0_pk PRIMARY KEY (companycode)
  47. , CONSTRAINT rap_analysis_KEY0_check CHECK (companycode IS NOT NULL)
  48. ) WITH (OIDS=FALSE);
  49.  
  50.  
  51. CREATE TABLE sageimport.rap_audit(
  52. userkey varchar(10)
  53. , workstationname varchar(30)
  54. , date date
  55. , sequenceno varchar(14)
  56. , apdivisionno varchar(2)
  57. , vendorno varchar(7)
  58. , vendorname varchar(50)
  59. , transactiontype varchar(1)
  60. , fieldname varchar(50)
  61. , fieldvalueoriginal varchar(50)
  62. , newfieldvalue varchar(50)
  63. , CONSTRAINT rap_audit_KEY0_pk PRIMARY KEY (userkey,date,sequenceno)
  64. , CONSTRAINT rap_audit_KEY0_check CHECK (userkey is not null and date is not null and sequenceno IS NOT NULL)
  65. , CONSTRAINT rap_audit_KEY1_unique UNIQUE (sequenceno)
  66. ) WITH (OIDS=FALSE);
  67.  
  68.  
  69. CREATE TABLE sageimport.rap_checkhistorydetail(
  70. bankcode varchar(1)
  71. , checkno varchar(10)
  72. , checkseqno varchar(6)
  73. , invoiceno varchar(20)
  74. , invoiceseqno varchar(6)
  75. , invoicedate date
  76. , apdivisionno varchar(2)
  77. , vendorno varchar(7)
  78. , vendorname varchar(50)
  79. , comment varchar(40)
  80. , form1099 varchar(1)
  81. , box1099 varchar(3)
  82. , amountpaid numeric(15,4)
  83. , discountamt numeric(15,4)
  84. , unapplieddiscountamt numeric(15,4)
  85. , retentionamt numeric(15,4)
  86. , CONSTRAINT rap_checkhistorydetail_KEY0_pk PRIMARY KEY (bankcode,checkno,checkseqno,invoiceno,invoiceseqno)
  87. , CONSTRAINT rap_checkhistorydetail_KEY0_check CHECK (bankcode is not null and checkno is not null and checkseqno is not null and invoiceno is not null and invoiceseqno IS NOT NULL)
  88. ) WITH (OIDS=FALSE);
  89. CREATE INDEX rap_checkhistorydetail_KEY1_index ON sageimport.rap_checkhistorydetail (invoiceno,invoiceseqno,bankcode,checkno,checkseqno);
  90. CREATE INDEX rap_checkhistorydetail_KEY2_index ON sageimport.rap_checkhistorydetail (apdivisionno,vendorno,bankcode,checkno,checkseqno,invoiceno,invoiceseqno);
  91.  
  92.  
  93. CREATE TABLE sageimport.rap_checkhistoryheader(
  94. bankcode varchar(1)
  95. , checkno varchar(10)
  96. , checkseqno varchar(6)
  97. , checktype varchar(1)
  98. , checkdate date
  99. , apdivisionno varchar(2)
  100. , vendorno varchar(7)
  101. , vendorname varchar(50)
  102. , sourcejournal varchar(2)
  103. , sourcejournalbatchno varchar(6)
  104. , checkcomment varchar(40)
  105. , transactiondate date
  106. , transferapdivisionno varchar(2)
  107. , transfervendorno varchar(7)
  108. , transferinvoiceno varchar(20)
  109. , transferinvoicedate date
  110. , transferform1099 varchar(1)
  111. , transferbox1099 varchar(3)
  112. , transferdiscountamt numeric(15,4)
  113. , checkamt numeric(15,4)
  114. , dateupdated date
  115. , timeupdated varchar(8)
  116. , userupdatedkey varchar(10)
  117. , achelectronicpayment varchar(1)
  118. , wiretransferno varchar(30)
  119. , achelectronicpaymentamt numeric(15,4)
  120. , clearedbank varchar(1)
  121. , cleareddate date
  122. , datecreated date
  123. , timecreated varchar(8)
  124. , usercreatedkey varchar(10)
  125. , CONSTRAINT rap_checkhistoryheader_KEY0_pk PRIMARY KEY (bankcode,checkno,checkseqno)
  126. , CONSTRAINT rap_checkhistoryheader_KEY0_check CHECK (bankcode is not null and checkno is not null and checkseqno IS NOT NULL)
  127. ) WITH (OIDS=FALSE);
  128. CREATE INDEX rap_checkhistoryheader_KEY1_index ON sageimport.rap_checkhistoryheader (apdivisionno,vendorno,bankcode,checkno,checkseqno);
  129. CREATE INDEX rap_checkhistoryheader_KEY2_index ON sageimport.rap_checkhistoryheader (vendorname,bankcode,checkno,checkseqno);
  130. CREATE INDEX rap_checkhistoryheader_KEY3_index ON sageimport.rap_checkhistoryheader (checkdate,bankcode,checkno,checkseqno);
  131.  
  132.  
  133. CREATE TABLE sageimport.rap_dailypostingwork(
  134. postingdate date
  135. , sourcejournal varchar(2)
  136. , registerno varchar(6)
  137. , accountkey varchar(9)
  138. , sequenceno varchar(14)
  139. , sourcemodule varchar(2)
  140. , postingcomment text
  141. , documenttype varchar(1)
  142. , documentno varchar(20)
  143. , docsequenceno varchar(14)
  144. , receiptno varchar(7)
  145. , batchtype varchar(2)
  146. , batchno varchar(5)
  147. , lineseqno varchar(14)
  148. , apdivisionno varchar(2)
  149. , vendorno varchar(7)
  150. , ardivisionno varchar(2)
  151. , customerno varchar(20)
  152. , debitamount numeric(15,4)
  153. , creditamount numeric(15,4)
  154. , CONSTRAINT rap_dailypostingwork_KEY0_pk PRIMARY KEY (postingdate,sourcejournal,registerno,accountkey,sequenceno)
  155. , CONSTRAINT rap_dailypostingwork_KEY0_check CHECK (postingdate is not null and sourcejournal is not null and registerno is not null and accountkey is not null and sequenceno IS NOT NULL)
  156. , CONSTRAINT rap_dailypostingwork_KEY1_unique UNIQUE (sequenceno)
  157. ) WITH (OIDS=FALSE);
  158. CREATE INDEX rap_dailypostingwork_KEY2_index ON sageimport.rap_dailypostingwork (registerno,postingdate,sourcejournal,accountkey,sequenceno);
  159. CREATE INDEX rap_dailypostingwork_KEY3_index ON sageimport.rap_dailypostingwork (accountkey,postingdate,sourcejournal,registerno,sequenceno);
  160.  
  161.  
  162. CREATE TABLE sageimport.rap_division(
  163. apdivisionno varchar(2)
  164. , apdivisiondesc varchar(30)
  165. , accountspayableacctkey varchar(9)
  166. , discountsearnedortakenacctkey varchar(9)
  167. , cashacctkey varchar(9)
  168. , discountslostacctkey varchar(9)
  169. , retentionpayableacctkey varchar(9)
  170. , freightacctkey varchar(9)
  171. , salestaxacctkey varchar(9)
  172. , nonrecoverabletaxacctkey varchar(9)
  173. , usetaxacctkey varchar(9)
  174. , datecreated date
  175. , timecreated varchar(8)
  176. , usercreatedkey varchar(10)
  177. , dateupdated date
  178. , timeupdated varchar(8)
  179. , userupdatedkey varchar(10)
  180. , CONSTRAINT rap_division_KEY0_pk PRIMARY KEY (apdivisionno)
  181. , CONSTRAINT rap_division_KEY0_check CHECK (apdivisionno IS NOT NULL)
  182. ) WITH (OIDS=FALSE);
  183.  
  184.  
  185. CREATE TABLE sageimport.rap_invoicehistorydetail(
  186. invoiceno varchar(20)
  187. , headerseqno varchar(6)
  188. , detailseqno varchar(6)
  189. , accountkey varchar(9)
  190. , jobno varchar(7)
  191. , costcode varchar(9)
  192. , costtype varchar(1)
  193. , commenttext text
  194. , transferapdivisionno varchar(2)
  195. , transfervendorno varchar(7)
  196. , transferinvoiceno varchar(20)
  197. , transferform1099 varchar(1)
  198. , transferbox1099 varchar(3)
  199. , itemcode varchar(30)
  200. , itemcodedesc varchar(30)
  201. , itemtype varchar(1)
  202. , extendeddescriptionkey varchar(10)
  203. , usetax varchar(1)
  204. , requireddate date
  205. , vendorpricecode varchar(4)
  206. , valuation varchar(1)
  207. , unitofmeasure varchar(4)
  208. , warehousecode varchar(3)
  209. , powarehousecode varchar(3)
  210. , productline varchar(4)
  211. , workorderno varchar(7)
  212. , workorderstepno varchar(4)
  213. , workordersubsteppfx varchar(1)
  214. , workordersubstepsfx varchar(4)
  215. , workordertransactiontype varchar(1)
  216. , vendoraliasitemno varchar(30)
  217. , taxclass varchar(2)
  218. , assettemplate varchar(25)
  219. , retentionrate numeric(15,4)
  220. , retentionamt numeric(15,4)
  221. , transferdiscount numeric(15,4)
  222. , quantityordered numeric(15,4)
  223. , quantityreceived numeric(15,4)
  224. , quantityinvoiced numeric(15,4)
  225. , unitcost numeric(15,4)
  226. , originalunitcost numeric(15,4)
  227. , extensionamt numeric(15,4)
  228. , quantityorderedoriginal numeric(15,4)
  229. , unitofmeasureconvfactor numeric(15,4)
  230. , salesorderno varchar(7)
  231. , customerpono varchar(30)
  232. , CONSTRAINT rap_invoicehistorydetail_KEY0_pk PRIMARY KEY (invoiceno,headerseqno,detailseqno)
  233. , CONSTRAINT rap_invoicehistorydetail_KEY0_check CHECK (invoiceno is not null and headerseqno is not null and detailseqno IS NOT NULL)
  234. ) WITH (OIDS=FALSE);
  235. CREATE INDEX rap_invoicehistorydetail_KEY1_index ON sageimport.rap_invoicehistorydetail (extendeddescriptionkey,invoiceno,headerseqno,detailseqno);
  236. CREATE INDEX rap_invoicehistorydetail_KEY2_index ON sageimport.rap_invoicehistorydetail (invoiceno,headerseqno,transferapdivisionno,transfervendorno);
  237.  
  238.  
  239. CREATE TABLE sageimport.rap_invoicehistoryheader(
  240. invoiceno varchar(20)
  241. , headerseqno varchar(6)
  242. , modulecode varchar(3)
  243. , invoicetype varchar(1)
  244. , apdivisionno varchar(2)
  245. , vendorno varchar(7)
  246. , invoicedate date
  247. , invoiceduedate date
  248. , invoicediscountdate date
  249. , transactiondate date
  250. , termscode varchar(2)
  251. , holdpayment varchar(1)
  252. , comment varchar(40)
  253. , prepaidapplytoinvoiceno varchar(20)
  254. , prepaidpaymentdate date
  255. , prepaidcheckno varchar(10)
  256. , sourcejournal varchar(2)
  257. , sourcejournalno varchar(6)
  258. , form1099 varchar(1)
  259. , box1099 varchar(3)
  260. , separatecheck varchar(1)
  261. , jobno varchar(7)
  262. , vendorname varchar(50)
  263. , taxschedule varchar(9)
  264. , taxclass varchar(2)
  265. , usetax varchar(1)
  266. , purchaseorderno varchar(7)
  267. , receiptno varchar(6)
  268. , receiptdate date
  269. , purchaseaddresscode varchar(4)
  270. , purchasename varchar(50)
  271. , purchaseaddress1 varchar(30)
  272. , purchaseaddress2 varchar(30)
  273. , purchaseaddress3 varchar(30)
  274. , purchasecity varchar(20)
  275. , purchasestate varchar(2)
  276. , purchasezipcode varchar(10)
  277. , purchasecountrycode varchar(3)
  278. , shiptocode varchar(4)
  279. , shiptoname varchar(50)
  280. , shiptoaddress1 varchar(30)
  281. , shiptoaddress2 varchar(30)
  282. , shiptoaddress3 varchar(30)
  283. , shiptocity varchar(20)
  284. , shiptostate varchar(2)
  285. , shiptozipcode varchar(10)
  286. , shiptocountrycode varchar(3)
  287. , requireddate date
  288. , shipvia varchar(15)
  289. , fob varchar(15)
  290. , warehousecode varchar(3)
  291. , confirmto varchar(30)
  292. , ardivisionno varchar(2)
  293. , customerno varchar(20)
  294. , codcheckno varchar(10)
  295. , bankcode varchar(1)
  296. , purchaseordertype varchar(1)
  297. , purchaseorderdate date
  298. , codno varchar(10)
  299. , userkey varchar(10)
  300. , invoiceamt numeric(15,4)
  301. , netinvoiceamt numeric(15,4)
  302. , discountamt numeric(15,4)
  303. , retentionamt numeric(15,4)
  304. , prepaymentamt numeric(15,4)
  305. , taxableamt numeric(15,4)
  306. , nontaxableamt numeric(15,4)
  307. , freightamt numeric(15,4)
  308. , taxamt numeric(15,4)
  309. , nonrecoverableamt numeric(15,4)
  310. , taxablemiscchargeamt numeric(15,4)
  311. , nontaxablemiscchargeamt numeric(15,4)
  312. , totalcostforfrghtalloc numeric(15,4)
  313. , prepaidfreight numeric(15,4)
  314. , codamount numeric(15,4)
  315. , dateupdated date
  316. , timeupdated varchar(8)
  317. , userupdatedkey varchar(10)
  318. , datecreated date
  319. , timecreated varchar(8)
  320. , usercreatedkey varchar(10)
  321. , CONSTRAINT rap_invoicehistoryheader_KEY0_pk PRIMARY KEY (invoiceno,headerseqno)
  322. , CONSTRAINT rap_invoicehistoryheader_KEY0_check CHECK (invoiceno is not null and headerseqno IS NOT NULL)
  323. ) WITH (OIDS=FALSE);
  324. CREATE INDEX rap_invoicehistoryheader_KEY1_index ON sageimport.rap_invoicehistoryheader (apdivisionno,vendorno,invoiceno,headerseqno);
  325.  
  326.  
  327. CREATE TABLE sageimport.rap_invoicehistorytaxsummary(
  328. invoiceno varchar(20)
  329. , headerseqno varchar(6)
  330. , scheduleseqno varchar(6)
  331. , taxcode varchar(15)
  332. , exemptionno varchar(20)
  333. , taxablepurchasesamt numeric(15,4)
  334. , nontaxablepurchasesamt numeric(15,4)
  335. , taxablefreightamt numeric(15,4)
  336. , taxabletaxamt numeric(15,4)
  337. , exemptpurchasesamt numeric(15,4)
  338. , taxamt numeric(15,4)
  339. , nontaxablefreightamt numeric(15,4)
  340. , usetaxamt numeric(15,4)
  341. , nonrecoverableamt numeric(15,4)
  342. , CONSTRAINT rap_invoicehistorytaxsummary_KEY0_pk PRIMARY KEY (invoiceno,headerseqno,scheduleseqno,taxcode)
  343. , CONSTRAINT rap_invoicehistorytaxsummary_KEY0_check CHECK (invoiceno is not null and headerseqno is not null and scheduleseqno is not null and taxcode IS NOT NULL)
  344. ) WITH (OIDS=FALSE);
  345.  
  346.  
  347. CREATE TABLE sageimport.rap_jobdistributiondetail(
  348. apdivisionno varchar(2)
  349. , vendorno varchar(7)
  350. , invoiceno varchar(20)
  351. , jobno varchar(7)
  352. , costcode varchar(9)
  353. , costtype varchar(1)
  354. , distributionamt numeric(15,4)
  355. , retentionamt numeric(15,4)
  356. , balance numeric(15,4)
  357. , amountappliedtoday numeric(15,4)
  358. , dateupdated date
  359. , timeupdated varchar(8)
  360. , userupdatedkey varchar(10)
  361. , CONSTRAINT rap_jobdistributiondetail_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,invoiceno,jobno,costcode,costtype)
  362. , CONSTRAINT rap_jobdistributiondetail_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and invoiceno is not null and jobno is not null and costcode is not null and costtype IS NOT NULL)
  363. ) WITH (OIDS=FALSE);
  364.  
  365.  
  366. CREATE TABLE sageimport.rap_lastbankused(
  367. userkey varchar(10)
  368. , workstationname varchar(30)
  369. , bankcode varchar(1)
  370. , CONSTRAINT rap_lastbankused_KEY0_pk PRIMARY KEY (userkey)
  371. , CONSTRAINT rap_lastbankused_KEY0_check CHECK (userkey IS NOT NULL)
  372. ) WITH (OIDS=FALSE);
  373. CREATE INDEX rap_lastbankused_KEY1_index ON sageimport.rap_lastbankused (workstationname);
  374.  
  375.  
  376. CREATE TABLE sageimport.rap_openinvoice(
  377. apdivisionno varchar(2)
  378. , vendorno varchar(7)
  379. , invoiceno varchar(20)
  380. , invoicedate date
  381. , invoiceduedate date
  382. , invoicediscountdate date
  383. , invoicehistoryheaderseqno varchar(6)
  384. , postingdate date
  385. , termscode varchar(2)
  386. , holdpayment varchar(1)
  387. , comment varchar(40)
  388. , jobno varchar(7)
  389. , checkno varchar(10)
  390. , checkdate date
  391. , paidtoday varchar(1)
  392. , form1099 varchar(1)
  393. , box1099 varchar(3)
  394. , separatecheck varchar(1)
  395. , taxschedule varchar(9)
  396. , taxclass varchar(2)
  397. , usetax varchar(1)
  398. , invoiceamt numeric(15,4)
  399. , discountamt numeric(15,4)
  400. , retentioncost numeric(15,4)
  401. , balance numeric(15,4)
  402. , taxableamt numeric(15,4)
  403. , nontaxableamt numeric(15,4)
  404. , freightamt numeric(15,4)
  405. , taxamt numeric(15,4)
  406. , nonrecoverableamt numeric(15,4)
  407. , dateupdated date
  408. , timeupdated varchar(8)
  409. , userupdatedkey varchar(10)
  410. , wiretransferno varchar(30)
  411. , checktype varchar(1)
  412. , datecreated date
  413. , timecreated varchar(8)
  414. , usercreatedkey varchar(10)
  415. , CONSTRAINT rap_openinvoice_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,invoiceno)
  416. , CONSTRAINT rap_openinvoice_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and invoiceno IS NOT NULL)
  417. ) WITH (OIDS=FALSE);
  418. CREATE INDEX rap_openinvoice_KEY1_index ON sageimport.rap_openinvoice (apdivisionno,vendorno,invoicedate,invoiceno);
  419. CREATE INDEX rap_openinvoice_KEY2_index ON sageimport.rap_openinvoice (apdivisionno,vendorno,invoicedate,invoiceno);
  420.  
  421.  
  422. CREATE TABLE sageimport.rap_openinvoicetaxsummary(
  423. apdivisionno varchar(2)
  424. , vendorno varchar(7)
  425. , invoiceno varchar(20)
  426. , scheduleseqno varchar(6)
  427. , taxcode varchar(15)
  428. , exemptionno varchar(20)
  429. , taxablepurchasesamt numeric(15,4)
  430. , taxablefreightamt numeric(15,4)
  431. , taxabletaxamt numeric(15,4)
  432. , nontaxablepurchasesamt numeric(15,4)
  433. , nontaxablefreightamt numeric(15,4)
  434. , exemptpurchasesamt numeric(15,4)
  435. , usetaxamt numeric(15,4)
  436. , nonrecoverableamt numeric(15,4)
  437. , taxamt numeric(15,4)
  438. , dateupdated date
  439. , timeupdated varchar(8)
  440. , userupdatedkey varchar(10)
  441. , CONSTRAINT rap_openinvoicetaxsummary_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,invoiceno,scheduleseqno,taxcode)
  442. , CONSTRAINT rap_openinvoicetaxsummary_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and invoiceno is not null and scheduleseqno is not null and taxcode IS NOT NULL)
  443. ) WITH (OIDS=FALSE);
  444.  
  445.  
  446. CREATE TABLE sageimport.rap_options(
  447. modulecode varchar(3)
  448. , newsystem varchar(1)
  449. , divisions varchar(1)
  450. , agingcategoriestouseforinv varchar(1)
  451. , agingcategory1 numeric(15,4)
  452. , agingcategory2 numeric(15,4)
  453. , agingcategory3 numeric(15,4)
  454. , agingcategory4 numeric(15,4)
  455. , defaultinvoicedisplay varchar(1)
  456. , displayinvoiceszerobalance varchar(1)
  457. , salestaxreporting varchar(1)
  458. , currentfiscalyr varchar(4)
  459. , currentperiod varchar(2)
  460. , enable1099reporting varchar(1)
  461. , default1099calendaryr varchar(4)
  462. , integrategeneralledger varchar(1)
  463. , integratebankrec varchar(1)
  464. , integratejobcost varchar(1)
  465. , invoiceregisterindetail varchar(1)
  466. , manualcheckregisterindetail varchar(1)
  467. , checkregisterindetail varchar(1)
  468. , daystoretainpaidinvs numeric(15,4)
  469. , accountfordisctsearnedorlost varchar(1)
  470. , applychangestoremittoaddr varchar(1)
  471. , invoicecomments varchar(1)
  472. , manualcheckcomments varchar(1)
  473. , checkscomments varchar(1)
  474. , calcsalestaxinapdataentry varchar(1)
  475. , expensefreightseparately varchar(1)
  476. , defaultbankcode varchar(1)
  477. , defaultbankcodetolastused varchar(1)
  478. , incrementnextchecknoduringprnt varchar(1)
  479. , displaywarningwhenpastdiscdue varchar(1)
  480. , sortinvregistersbyvendorname varchar(1)
  481. , printgldistoncheckregister varchar(1)
  482. , printglacctdesconregisters varchar(1)
  483. , printtaxjrnlsindetail varchar(1)
  484. , printtaxdetailonregisters varchar(1)
  485. , alwaysprintextendedstubrpt varchar(1)
  486. , vendorchangestotrack varchar(1)
  487. , trackadditionsindetail varchar(1)
  488. , trackdetailedinvpaymenthist varchar(1)
  489. , retaincommentlines varchar(1)
  490. , yearstoretainvendorhist numeric(15,4)
  491. , includesalestaxandfreight varchar(1)
  492. , yearstoretain1099paymenthist numeric(15,4)
  493. , bankcodeprinting varchar(1)
  494. , restartcheckprinting varchar(1)
  495. , restartcheckno varchar(10)
  496. , startingchecknothisrun varchar(10)
  497. , sequencenoforcreditcardxfer varchar(5)
  498. , vendormask varchar(6)
  499. , companycode varchar(3)
  500. , dataversion numeric(15,4)
  501. , datasublevel numeric(15,4)
  502. , dateupdated date
  503. , timeupdated varchar(8)
  504. , userupdatedkey varchar(10)
  505. , displayclearedchecks varchar(1)
  506. , enablewiretransfers varchar(1)
  507. , enableexpensedisttables varchar(1)
  508. , allowlessthan100percent varchar(1)
  509. , printagedinvrptformultipleco varchar(1)
  510. , enableachelectronicpayments varchar(1)
  511. , postbankrecindetailach varchar(1)
  512. , printvendorremittanceadvice varchar(1)
  513. , nextvendorremittanceadviceno varchar(5)
  514. , allowpartialallocationofpayamt varchar(1)
  515. , resetprenotewhenrenumbervendor varchar(1)
  516. , yearstoretainelectronicpayhist numeric(15,4)
  517. , directoryforach varchar(150)
  518. , sequencenoforwiretransferxfer varchar(5)
  519. , acheffectivedate date
  520. , achbatchdesc varchar(30)
  521. , achnextprenotebatchno varchar(5)
  522. , CONSTRAINT rap_options_KEY0_pk PRIMARY KEY (modulecode)
  523. , CONSTRAINT rap_options_KEY0_check CHECK (modulecode IS NOT NULL)
  524. ) WITH (OIDS=FALSE);
  525.  
  526.  
  527. CREATE TABLE sageimport.rap_repetitiveinvoicedetail(
  528. apdivisionno varchar(2)
  529. , vendorno varchar(7)
  530. , referenceno varchar(4)
  531. , linekey varchar(6)
  532. , lineseqno varchar(14)
  533. , accountkey varchar(9)
  534. , commenttext text
  535. , distributionamt numeric(15,4)
  536. , distributionpercentage numeric(15,4)
  537. , CONSTRAINT rap_repetitiveinvoicedetail_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,referenceno,linekey)
  538. , CONSTRAINT rap_repetitiveinvoicedetail_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and referenceno is not null and linekey IS NOT NULL)
  539. ) WITH (OIDS=FALSE);
  540. CREATE INDEX rap_repetitiveinvoicedetail_KEY1_index ON sageimport.rap_repetitiveinvoicedetail (apdivisionno,vendorno,referenceno,lineseqno,linekey);
  541.  
  542.  
  543. CREATE TABLE sageimport.rap_repetitiveinvoiceheader(
  544. apdivisionno varchar(2)
  545. , vendorno varchar(7)
  546. , referenceno varchar(4)
  547. , selectcyclecode varchar(2)
  548. , startbillingdate date
  549. , termscode varchar(2)
  550. , comment varchar(40)
  551. , lastbilleddate date
  552. , form1099 varchar(1)
  553. , box1099 varchar(3)
  554. , separatecheck varchar(1)
  555. , taxschedule varchar(9)
  556. , taxclass varchar(2)
  557. , usetax varchar(1)
  558. , numberofpaymentstomake numeric(15,4)
  559. , numberofpaymentsmade numeric(15,4)
  560. , invoiceamt numeric(15,4)
  561. , netinvoiceamt numeric(15,4)
  562. , discountamt numeric(15,4)
  563. , originalbalance numeric(15,4)
  564. , billedtodateamt numeric(15,4)
  565. , taxableamt numeric(15,4)
  566. , nontaxableamt numeric(15,4)
  567. , freightamt numeric(15,4)
  568. , taxamt numeric(15,4)
  569. , nonrecoverableamt numeric(15,4)
  570. , datecreated date
  571. , timecreated varchar(8)
  572. , usercreatedkey varchar(10)
  573. , dateupdated date
  574. , timeupdated varchar(8)
  575. , userupdatedkey varchar(10)
  576. , tablecode varchar(6)
  577. , CONSTRAINT rap_repetitiveinvoiceheader_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,referenceno)
  578. , CONSTRAINT rap_repetitiveinvoiceheader_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and referenceno IS NOT NULL)
  579. ) WITH (OIDS=FALSE);
  580. CREATE INDEX rap_repetitiveinvoiceheader_KEY1_index ON sageimport.rap_repetitiveinvoiceheader (tablecode,apdivisionno,vendorno,referenceno);
  581.  
  582.  
  583. CREATE TABLE sageimport.rap_repetitiveinvoicetaxdetail(
  584. apdivisionno varchar(2)
  585. , vendorno varchar(7)
  586. , referenceno varchar(4)
  587. , scheduleseqno varchar(6)
  588. , taxcode varchar(15)
  589. , taxclass varchar(2)
  590. , purchasestaxable varchar(1)
  591. , taxablepurchasesamt numeric(15,4)
  592. , nontaxablepurchasesamt numeric(15,4)
  593. , exemptpurchasesamt numeric(15,4)
  594. , usetaxablepurchasesamt numeric(15,4)
  595. , taxrate numeric(15,4)
  596. , nonrecoverablepercent numeric(15,4)
  597. , CONSTRAINT rap_repetitiveinvoicetaxdetail_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,referenceno,scheduleseqno,taxcode,taxclass)
  598. , CONSTRAINT rap_repetitiveinvoicetaxdetail_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and referenceno is not null and scheduleseqno is not null and taxcode is not null and taxclass IS NOT NULL)
  599. ) WITH (OIDS=FALSE);
  600.  
  601.  
  602. CREATE TABLE sageimport.rap_repetitiveinvoicetaxsummary(
  603. apdivisionno varchar(2)
  604. , vendorno varchar(7)
  605. , referenceno varchar(4)
  606. , scheduleseqno varchar(6)
  607. , taxcode varchar(15)
  608. , exemptionno varchar(20)
  609. , expensetovendoritem varchar(1)
  610. , useexemptionsonfile varchar(1)
  611. , taxablepurchasesamt numeric(15,4)
  612. , taxablefreightamt numeric(15,4)
  613. , taxabletaxamt numeric(15,4)
  614. , nontaxablepurchasesamt numeric(15,4)
  615. , nontaxablefreightamt numeric(15,4)
  616. , exemptpurchasesamt numeric(15,4)
  617. , usetaxamt numeric(15,4)
  618. , nonrecoverableamt numeric(15,4)
  619. , taxamt numeric(15,4)
  620. , CONSTRAINT rap_repetitiveinvoicetaxsummary_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,referenceno,scheduleseqno,taxcode)
  621. , CONSTRAINT rap_repetitiveinvoicetaxsummary_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and referenceno is not null and scheduleseqno is not null and taxcode IS NOT NULL)
  622. ) WITH (OIDS=FALSE);
  623.  
  624.  
  625. CREATE TABLE sageimport.rap_salestax(
  626. taxcode varchar(15)
  627. , transactiondate date
  628. , invoiceno varchar(20)
  629. , apdivisionno varchar(2)
  630. , vendorno varchar(7)
  631. , vendorname varchar(50)
  632. , modulecode varchar(3)
  633. , sourcejournalno varchar(6)
  634. , primarytaxcode varchar(15)
  635. , exemptionno varchar(20)
  636. , override varchar(1)
  637. , taxablepurchasesamt numeric(15,4)
  638. , nontaxablepurchasesamt numeric(15,4)
  639. , taxablefreightamt numeric(15,4)
  640. , nontaxablefreightamt numeric(15,4)
  641. , taxamt numeric(15,4)
  642. , usetaxamt numeric(15,4)
  643. , taxabletaxamt numeric(15,4)
  644. , exemptpurchasesamt numeric(15,4)
  645. , nonrecoverableamt numeric(15,4)
  646. , dateupdated date
  647. , timeupdated varchar(8)
  648. , userupdatedkey varchar(10)
  649. , CONSTRAINT rap_salestax_KEY0_pk PRIMARY KEY (taxcode,transactiondate,invoiceno)
  650. , CONSTRAINT rap_salestax_KEY0_check CHECK (taxcode is not null and transactiondate is not null and invoiceno IS NOT NULL)
  651. ) WITH (OIDS=FALSE);
  652. CREATE INDEX rap_salestax_KEY1_index ON sageimport.rap_salestax (transactiondate,taxcode,invoiceno);
  653.  
  654.  
  655. CREATE TABLE sageimport.rap_termscode(
  656. termscode varchar(2)
  657. , termscodedesc varchar(30)
  658. , daysbeforedue numeric(15,4)
  659. , duedateadayofthemonth varchar(1)
  660. , minimumdaysallowedinv numeric(15,4)
  661. , daysdiscountallowed numeric(15,4)
  662. , discountdateadayofthemo varchar(1)
  663. , minimumdaysalloweddisc numeric(15,4)
  664. , discountrate numeric(15,4)
  665. , datecreated date
  666. , timecreated varchar(8)
  667. , usercreatedkey varchar(10)
  668. , dateupdated date
  669. , timeupdated varchar(8)
  670. , userupdatedkey varchar(10)
  671. , CONSTRAINT rap_termscode_KEY0_pk PRIMARY KEY (termscode)
  672. , CONSTRAINT rap_termscode_KEY0_check CHECK (termscode IS NOT NULL)
  673. ) WITH (OIDS=FALSE);
  674.  
  675.  
  676. CREATE TABLE sageimport.rap_transactionpaymenthistory(
  677. apdivisionno varchar(2)
  678. , vendorno varchar(7)
  679. , invoiceno varchar(20)
  680. , invoicehistoryheaderseqno varchar(6)
  681. , transactiondate date
  682. , sequenceno varchar(6)
  683. , transactiontype varchar(1)
  684. , checkno varchar(10)
  685. , checkhistoryheaderseqno varchar(6)
  686. , checkdate date
  687. , applytoinvoice varchar(20)
  688. , applyhistoryheaderseqno varchar(6)
  689. , bankcode varchar(1)
  690. , transactionamt numeric(15,4)
  691. , discountamt numeric(15,4)
  692. , retentionamt numeric(15,4)
  693. , dateupdated date
  694. , timeupdated varchar(8)
  695. , userupdatedkey varchar(10)
  696. , checktype varchar(1)
  697. , clearedbank varchar(1)
  698. , cleareddate date
  699. , wiretransferno varchar(30)
  700. , brcheckno varchar(10)
  701. , brachcheckseqno varchar(6)
  702. , documenttype varchar(1)
  703. , entryno varchar(6)
  704. , CONSTRAINT rap_transactionpaymenthistory_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,invoiceno,transactiondate,sequenceno)
  705. , CONSTRAINT rap_transactionpaymenthistory_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and invoiceno is not null and transactiondate is not null and sequenceno IS NOT NULL)
  706. ) WITH (OIDS=FALSE);
  707. CREATE INDEX rap_transactionpaymenthistory_KEY1_index ON sageimport.rap_transactionpaymenthistory (apdivisionno,vendorno,transactiondate,invoiceno,sequenceno);
  708. CREATE INDEX rap_transactionpaymenthistory_KEY2_index ON sageimport.rap_transactionpaymenthistory (apdivisionno,vendorno,transactiondate,invoiceno,sequenceno);
  709. CREATE INDEX rap_transactionpaymenthistory_KEY3_index ON sageimport.rap_transactionpaymenthistory (bankcode,documenttype,brcheckno,brachcheckseqno,checkdate,entryno);
  710.  
  711.  
  712. CREATE TABLE sageimport.rap_vendor(
  713. apdivisionno varchar(2)
  714. , vendorno varchar(7)
  715. , vendorname varchar(50)
  716. , addressline1 varchar(30)
  717. , addressline2 varchar(30)
  718. , addressline3 varchar(30)
  719. , city varchar(20)
  720. , state varchar(2)
  721. , zipcode varchar(10)
  722. , countrycode varchar(3)
  723. , primarycontact varchar(10)
  724. , telephoneno varchar(17)
  725. , telephoneext varchar(5)
  726. , faxno varchar(17)
  727. , emailaddress varchar(250)
  728. , urladdress varchar(50)
  729. , termscode varchar(2)
  730. , reference varchar(15)
  731. , temporaryvendor varchar(1)
  732. , creditcardvendor varchar(1)
  733. , holdpayment varchar(1)
  734. , exemptionnoonfile varchar(1)
  735. , taxschedule varchar(9)
  736. , taxclass varchar(2)
  737. , accountkey varchar(9)
  738. , separatecheck varchar(1)
  739. , comment varchar(30)
  740. , sort varchar(10)
  741. , batchfax varchar(1)
  742. , useporeceiptofinvforvendor varchar(1)
  743. , primarypurchaseaddresscode varchar(4)
  744. , vendortype varchar(1)
  745. , form1099 varchar(1)
  746. , taxpayeridsocialsecurityno varchar(9)
  747. , box1099 varchar(3)
  748. , miscbox9 varchar(1)
  749. , lastpurchasedate date
  750. , lastpaymentdate date
  751. , lastcheckno varchar(10)
  752. , lastcheckamt numeric(15,4)
  753. , retentionrate numeric(15,4)
  754. , averagedaystopay numeric(15,4)
  755. , averagedaysoverdue numeric(15,4)
  756. , balancedue numeric(15,4)
  757. , numberofinvtouseincalc numeric(15,4)
  758. , datecreated date
  759. , timecreated varchar(8)
  760. , usercreatedkey varchar(10)
  761. , dateupdated date
  762. , timeupdated varchar(8)
  763. , userupdatedkey varchar(10)
  764. , vendorstatus varchar(1)
  765. , inactivereasoncode varchar(5)
  766. , electronicpayment varchar(1)
  767. , standardentryclass varchar(3)
  768. , electronicconsentsigned1099 varchar(1)
  769. , fatca varchar(1)
  770. , CONSTRAINT rap_vendor_KEY0_pk PRIMARY KEY (apdivisionno,vendorno)
  771. , CONSTRAINT rap_vendor_KEY0_check CHECK (apdivisionno is not null and vendorno IS NOT NULL)
  772. ) WITH (OIDS=FALSE);
  773. CREATE INDEX rap_vendor_KEY1_index ON sageimport.rap_vendor (vendorname,apdivisionno,vendorno);
  774. CREATE INDEX rap_vendor_KEY2_index ON sageimport.rap_vendor (sort,apdivisionno,vendorno);
  775. CREATE INDEX rap_vendor_KEY3_index ON sageimport.rap_vendor (zipcode,apdivisionno,vendorno);
  776.  
  777.  
  778. CREATE TABLE sageimport.rap_vendorcontact(
  779. apdivisionno varchar(2)
  780. , vendorno varchar(7)
  781. , contactcode varchar(10)
  782. , contactname varchar(30)
  783. , addressline1 varchar(30)
  784. , addressline2 varchar(30)
  785. , addressline3 varchar(30)
  786. , city varchar(20)
  787. , state varchar(2)
  788. , zipcode varchar(10)
  789. , countrycode varchar(3)
  790. , salutation varchar(10)
  791. , contacttitle varchar(15)
  792. , telephoneno1 varchar(17)
  793. , telephoneext1 varchar(5)
  794. , telephoneno2 varchar(17)
  795. , telephoneext2 varchar(5)
  796. , faxno varchar(17)
  797. , emailaddress varchar(50)
  798. , contactnotes text
  799. , datecreated date
  800. , timecreated varchar(8)
  801. , usercreatedkey varchar(10)
  802. , dateupdated date
  803. , timeupdated varchar(8)
  804. , userupdatedkey varchar(10)
  805. , CONSTRAINT rap_vendorcontact_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,contactcode)
  806. , CONSTRAINT rap_vendorcontact_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and contactcode IS NOT NULL)
  807. ) WITH (OIDS=FALSE);
  808.  
  809.  
  810. CREATE TABLE sageimport.rap_vendordocumentcontacts(
  811. apdivisionno varchar(2)
  812. , vendorno varchar(7)
  813. , document varchar(30)
  814. , linekey varchar(6)
  815. , lineseqno varchar(14)
  816. , recordtype varchar(1)
  817. , tocontactcode varchar(10)
  818. , toadditionalemailaddress varchar(50)
  819. , toadditionalfaxno varchar(17)
  820. , toadditionalfaxrecipientname varchar(30)
  821. , datecreated date
  822. , timecreated varchar(8)
  823. , usercreatedkey varchar(10)
  824. , dateupdated date
  825. , timeupdated varchar(8)
  826. , userupdatedkey varchar(10)
  827. , CONSTRAINT rap_vendordocumentcontacts_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,document,linekey)
  828. , CONSTRAINT rap_vendordocumentcontacts_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and document is not null and linekey IS NOT NULL)
  829. ) WITH (OIDS=FALSE);
  830. CREATE INDEX rap_vendordocumentcontacts_KEY1_index ON sageimport.rap_vendordocumentcontacts (apdivisionno,vendorno,document,lineseqno,linekey);
  831. CREATE INDEX rap_vendordocumentcontacts_KEY2_index ON sageimport.rap_vendordocumentcontacts (apdivisionno,vendorno,document,recordtype,toadditionalemailaddress,toadditionalfaxrecipientname,tocontactcode,linekey);
  832.  
  833.  
  834. CREATE TABLE sageimport.rap_vendordocuments(
  835. apdivisionno varchar(2)
  836. , vendorno varchar(7)
  837. , document varchar(30)
  838. , printdocument varchar(1)
  839. , emaildocument varchar(1)
  840. , faxdocument varchar(1)
  841. , documentpassword varchar(33)
  842. , usevendoremailaddress varchar(1)
  843. , usefaxnoindataentry varchar(1)
  844. , usevendorfaxno varchar(1)
  845. , datecreated date
  846. , timecreated varchar(8)
  847. , usercreatedkey varchar(10)
  848. , dateupdated date
  849. , timeupdated varchar(8)
  850. , userupdatedkey varchar(10)
  851. , useemailaddressindataentry varchar(1)
  852. , CONSTRAINT rap_vendordocuments_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,document)
  853. , CONSTRAINT rap_vendordocuments_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and document IS NOT NULL)
  854. ) WITH (OIDS=FALSE);
  855.  
  856.  
  857. CREATE TABLE sageimport.rap_vendormemo(
  858. apdivisionno varchar(2)
  859. , vendorno varchar(7)
  860. , memocode varchar(10)
  861. , seqno varchar(6)
  862. , memodesc varchar(30)
  863. , memodate date
  864. , expirationdate date
  865. , reminderstartdate date
  866. , reminderenddate date
  867. , autodisplaysetting varchar(1)
  868. , memotext text
  869. , attachment varchar(128)
  870. , originalmodulecode varchar(3)
  871. , originalmemotype varchar(2)
  872. , datecreated date
  873. , timecreated varchar(8)
  874. , usercreatedkey varchar(10)
  875. , dateupdated date
  876. , timeupdated varchar(8)
  877. , userupdatedkey varchar(10)
  878. , CONSTRAINT rap_vendormemo_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,memocode,seqno)
  879. , CONSTRAINT rap_vendormemo_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and memocode is not null and seqno IS NOT NULL)
  880. ) WITH (OIDS=FALSE);
  881. CREATE INDEX rap_vendormemo_KEY1_index ON sageimport.rap_vendormemo (memocode,apdivisionno,vendorno);
  882.  
  883.  
  884. CREATE TABLE sageimport.rap_vendorpdflog(
  885. apdivisionno varchar(2)
  886. , vendorno varchar(7)
  887. , document varchar(60)
  888. , modulecode varchar(3)
  889. , documentkey varchar(10)
  890. , documentdate date
  891. , sequence varchar(3)
  892. , purchaseorderno varchar(7)
  893. , ordertype varchar(1)
  894. , accountingdate date
  895. , directory varchar(150)
  896. , filename varchar(100)
  897. , sent varchar(1)
  898. , updated varchar(1)
  899. , passwordprotected varchar(1)
  900. , password varchar(33)
  901. , datecreated date
  902. , timecreated varchar(8)
  903. , usercreatedkey varchar(10)
  904. , CONSTRAINT rap_vendorpdflog_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,document,modulecode,documentkey,documentdate,sequence)
  905. , CONSTRAINT rap_vendorpdflog_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and document is not null and modulecode is not null and documentkey is not null and documentdate is not null and sequence IS NOT NULL)
  906. ) WITH (OIDS=FALSE);
  907. CREATE INDEX rap_vendorpdflog_KEY1_index ON sageimport.rap_vendorpdflog (filename,apdivisionno,vendorno,document,modulecode,documentkey,documentdate,sequence);
  908. CREATE INDEX rap_vendorpdflog_KEY2_index ON sageimport.rap_vendorpdflog (documentdate,apdivisionno,vendorno,document,modulecode,documentkey,sequence);
  909. CREATE INDEX rap_vendorpdflog_KEY3_index ON sageimport.rap_vendorpdflog (updated,apdivisionno,vendorno,document,modulecode,documentkey,documentdate,sequence);
  910. CREATE INDEX rap_vendorpdflog_KEY4_index ON sageimport.rap_vendorpdflog (sent,apdivisionno,vendorno,document,modulecode,documentkey,documentdate,sequence);
  911.  
  912.  
  913. CREATE TABLE sageimport.rap_vendorpurchaseshistory(
  914. apdivisionno varchar(2)
  915. , vendorno varchar(7)
  916. , fiscalyear varchar(4)
  917. , fiscalperiod varchar(2)
  918. , purchases numeric(15,4)
  919. , payments numeric(15,4)
  920. , discountstaken numeric(15,4)
  921. , discountslost numeric(15,4)
  922. , dateupdated date
  923. , timeupdated varchar(8)
  924. , userupdatedkey varchar(10)
  925. , CONSTRAINT rap_vendorpurchaseshistory_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,fiscalyear,fiscalperiod)
  926. , CONSTRAINT rap_vendorpurchaseshistory_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and fiscalyear is not null and fiscalperiod IS NOT NULL)
  927. ) WITH (OIDS=FALSE);
  928. CREATE INDEX rap_vendorpurchaseshistory_KEY1_index ON sageimport.rap_vendorpurchaseshistory (fiscalyear,fiscalperiod,apdivisionno,vendorno);
  929. CREATE INDEX rap_vendorpurchaseshistory_KEY2_index ON sageimport.rap_vendorpurchaseshistory (fiscalyear,fiscalperiod,apdivisionno,vendorno);
  930.  
  931.  
  932. CREATE TABLE sageimport.rap_vendorremit(
  933. apdivisionno varchar(2)
  934. , vendorno varchar(7)
  935. , remittovendorname varchar(50)
  936. , remittoaddressline1 varchar(30)
  937. , remittoaddressline2 varchar(30)
  938. , remittoaddressline3 varchar(30)
  939. , remittocity varchar(20)
  940. , remittostate varchar(2)
  941. , remittozipcode varchar(10)
  942. , remittocountrycode varchar(3)
  943. , remittocontactcode varchar(10)
  944. , remittotelephoneno varchar(17)
  945. , remittotelephoneext varchar(5)
  946. , datecreated date
  947. , timecreated varchar(8)
  948. , usercreatedkey varchar(10)
  949. , dateupdated date
  950. , timeupdated varchar(8)
  951. , userupdatedkey varchar(10)
  952. , CONSTRAINT rap_vendorremit_KEY0_pk PRIMARY KEY (apdivisionno,vendorno)
  953. , CONSTRAINT rap_vendorremit_KEY0_check CHECK (apdivisionno is not null and vendorno IS NOT NULL)
  954. ) WITH (OIDS=FALSE);
  955.  
  956.  
  957. CREATE TABLE sageimport.rar_alternateinvoice(
  958. ardivisionno varchar(2)
  959. , customerno varchar(20)
  960. , ttype varchar(1)
  961. , invoicedate date
  962. , invoiceno varchar(7)
  963. , invoicetype varchar(2)
  964. , CONSTRAINT rar_alternateinvoice_KEY0_pk PRIMARY KEY (ardivisionno,customerno,ttype,invoicedate,invoiceno,invoicetype)
  965. , CONSTRAINT rar_alternateinvoice_KEY0_check CHECK (ardivisionno is not null and customerno is not null and ttype is not null and invoicedate is not null and invoiceno is not null and invoicetype IS NOT NULL)
  966. ) WITH (OIDS=FALSE);
  967.  
  968.  
  969. CREATE TABLE sageimport.rar_analysis(
  970. companycode varchar(3)
  971. , lastupdatedate date
  972. , period1endingdate date
  973. , period2endingdate date
  974. , period3endingdate date
  975. , period4endingdate date
  976. , period5endingdate date
  977. , period6endingdate date
  978. , currentnoofinvs numeric(15,4)
  979. , currenttotalrcvbls numeric(15,4)
  980. , currentover30days numeric(15,4)
  981. , currentover60days numeric(15,4)
  982. , period1noofinvs numeric(15,4)
  983. , period1totalrcvbls numeric(15,4)
  984. , period1over30days numeric(15,4)
  985. , period1over60days numeric(15,4)
  986. , period2noofinvs numeric(15,4)
  987. , period2totalrcvbls numeric(15,4)
  988. , period2over30days numeric(15,4)
  989. , period2over60days numeric(15,4)
  990. , period3noofinvs numeric(15,4)
  991. , period3totalrcvbls numeric(15,4)
  992. , period3over30days numeric(15,4)
  993. , period3over60days numeric(15,4)
  994. , period4noofinvs numeric(15,4)
  995. , period4totalrcvbls numeric(15,4)
  996. , period4over30days numeric(15,4)
  997. , period4over60days numeric(15,4)
  998. , period5noofinvs numeric(15,4)
  999. , period5totalrcvbls numeric(15,4)
  1000. , period5over30days numeric(15,4)
  1001. , period5over60days numeric(15,4)
  1002. , period6noofinvs numeric(15,4)
  1003. , period6totalrcvbls numeric(15,4)
  1004. , period6over30days numeric(15,4)
  1005. , period6over60days numeric(15,4)
  1006. , totalnoofdaysold numeric(15,4)
  1007. , totaloforiginalinvamounts numeric(15,4)
  1008. , totalnoofinvs numeric(15,4)
  1009. , dateupdated date
  1010. , timeupdated varchar(8)
  1011. , userupdatedkey varchar(10)
  1012. , CONSTRAINT rar_analysis_KEY0_pk PRIMARY KEY (companycode)
  1013. , CONSTRAINT rar_analysis_KEY0_check CHECK (companycode IS NOT NULL)
  1014. ) WITH (OIDS=FALSE);
  1015.  
  1016.  
  1017. CREATE TABLE sageimport.rar_audit(
  1018. userkey varchar(10)
  1019. , sequenceno varchar(14)
  1020. , workstationname varchar(30)
  1021. , date date
  1022. , ardivisionno varchar(2)
  1023. , customerno varchar(20)
  1024. , customername varchar(30)
  1025. , transactiontype varchar(1)
  1026. , fieldname varchar(50)
  1027. , fieldvalueoriginal varchar(50)
  1028. , newfieldvalue varchar(50)
  1029. , CONSTRAINT rar_audit_KEY0_pk PRIMARY KEY (userkey,date,sequenceno)
  1030. , CONSTRAINT rar_audit_KEY0_check CHECK (userkey is not null and date is not null and sequenceno IS NOT NULL)
  1031. , CONSTRAINT rar_audit_KEY1_unique UNIQUE (sequenceno)
  1032. ) WITH (OIDS=FALSE);
  1033. CREATE INDEX rar_audit_KEY2_index ON sageimport.rar_audit (workstationname,userkey,date,sequenceno);
  1034.  
  1035.  
  1036. CREATE TABLE sageimport.rar_cashreceiptshistory(
  1037. bankcode varchar(1)
  1038. , depositdate date
  1039. , depositno varchar(5)
  1040. , deposittype varchar(1)
  1041. , ardivisionno varchar(2)
  1042. , customerno varchar(20)
  1043. , checkno varchar(10)
  1044. , sequenceno varchar(6)
  1045. , postingdate date
  1046. , customername varchar(30)
  1047. , openitemcustomer varchar(1)
  1048. , transactiontype varchar(2)
  1049. , invoiceno varchar(7)
  1050. , invoicetype varchar(2)
  1051. , accountkey varchar(9)
  1052. , depositdesc varchar(30)
  1053. , batchno varchar(5)
  1054. , last4unencryptedcreditcardnos varchar(4)
  1055. , expirationdateyear varchar(4)
  1056. , expirationdatemonth varchar(2)
  1057. , corporatecustidpurchorder varchar(17)
  1058. , corporatetaxoverrd varchar(1)
  1059. , cardholdername varchar(30)
  1060. , creditcardtransactionid varchar(10)
  1061. , creditcardauthorizationno varchar(16)
  1062. , authorizationdate date
  1063. , authorizationtime varchar(8)
  1064. , avscity varchar(20)
  1065. , avsstate varchar(2)
  1066. , avszipcode varchar(10)
  1067. , creditcardcomment varchar(30)
  1068. , comment text
  1069. , cashamountapplied numeric(15,4)
  1070. , discountamountapplied numeric(15,4)
  1071. , invoicebalance numeric(15,4)
  1072. , corporatesalestax numeric(15,4)
  1073. , dateupdated date
  1074. , timeupdated varchar(8)
  1075. , userupdatedkey varchar(10)
  1076. , creditcardentryno varchar(6)
  1077. , soldtodivisionno varchar(2)
  1078. , soldtocustomerno varchar(20)
  1079. , paymenttype varchar(5)
  1080. , creditcardid varchar(10)
  1081. , cardtype varchar(1)
  1082. , bankaccounttype varchar(1)
  1083. , last4bankroutingnos varchar(4)
  1084. , last4bankaccountnos varchar(4)
  1085. , bankname varchar(30)
  1086. , avsaddressline1 varchar(30)
  1087. , avsaddressline2 varchar(30)
  1088. , avscountrycode varchar(3)
  1089. , creditcardemailaddress varchar(250)
  1090. , datecreated date
  1091. , timecreated varchar(8)
  1092. , usercreatedkey varchar(10)
  1093. , CONSTRAINT rar_cashreceiptshistory_KEY0_pk PRIMARY KEY (bankcode,depositdate,depositno,deposittype,ardivisionno,customerno,creditcardentryno,checkno,sequenceno)
  1094. , CONSTRAINT rar_cashreceiptshistory_KEY0_check CHECK (bankcode is not null and depositdate is not null and depositno is not null and deposittype is not null and ardivisionno is not null and customerno is not null and creditcardentryno is not null and checkno is not null and sequenceno IS NOT NULL)
  1095. ) WITH (OIDS=FALSE);
  1096. CREATE INDEX rar_cashreceiptshistory_KEY1_index ON sageimport.rar_cashreceiptshistory (ardivisionno,customerno);
  1097. CREATE INDEX rar_cashreceiptshistory_KEY2_index ON sageimport.rar_cashreceiptshistory (depositdate,bankcode,depositno,deposittype,ardivisionno,customerno,creditcardentryno,checkno,sequenceno);
  1098. CREATE INDEX rar_cashreceiptshistory_KEY3_index ON sageimport.rar_cashreceiptshistory (depositdate,bankcode,depositno,deposittype,ardivisionno,customerno,creditcardentryno,checkno,sequenceno);
  1099. CREATE INDEX rar_cashreceiptshistory_KEY4_index ON sageimport.rar_cashreceiptshistory (checkno,depositdate,bankcode,depositno,deposittype,ardivisionno,customerno,sequenceno);
  1100. CREATE INDEX rar_cashreceiptshistory_KEY5_index ON sageimport.rar_cashreceiptshistory (expirationdateyear,expirationdatemonth,bankcode,depositdate,depositno,ardivisionno,customerno,creditcardentryno,checkno,sequenceno);
  1101.  
  1102.  
  1103. CREATE TABLE sageimport.rar_changecustomersvalidate(
  1104. ardivisionno varchar(2)
  1105. , customerno varchar(20)
  1106. , customerstatus varchar(1)
  1107. , CONSTRAINT rar_changecustomersvalidate_KEY0_pk PRIMARY KEY (ardivisionno,customerno)
  1108. , CONSTRAINT rar_changecustomersvalidate_KEY0_check CHECK (ardivisionno is not null and customerno IS NOT NULL)
  1109. ) WITH (OIDS=FALSE);
  1110.  
  1111.  
  1112. CREATE TABLE sageimport.rar_customer(
  1113. ardivisionno varchar(2)
  1114. , customerno varchar(20)
  1115. , customername varchar(30)
  1116. , addressline1 varchar(30)
  1117. , addressline2 varchar(30)
  1118. , addressline3 varchar(30)
  1119. , city varchar(20)
  1120. , state varchar(2)
  1121. , zipcode varchar(10)
  1122. , countrycode varchar(3)
  1123. , telephoneno varchar(17)
  1124. , telephoneext varchar(5)
  1125. , faxno varchar(17)
  1126. , emailaddress varchar(250)
  1127. , urladdress varchar(50)
  1128. , ebmenabled varchar(1)
  1129. , ebmconsumeruserid varchar(15)
  1130. , batchfax varchar(1)
  1131. , defaultcreditcardpmttype varchar(5)
  1132. , contactcode varchar(10)
  1133. , shipmethod varchar(15)
  1134. , taxschedule varchar(9)
  1135. , taxexemptno varchar(15)
  1136. , termscode varchar(2)
  1137. , salespersondivisionno varchar(2)
  1138. , salespersonno varchar(4)
  1139. , comment varchar(30)
  1140. , sortfield varchar(10)
  1141. , temporarycustomer varchar(1)
  1142. , openitemcustomer varchar(1)
  1143. , residentialaddress varchar(1)
  1144. , statementcycle varchar(1)
  1145. , printdunningmessage varchar(1)
  1146. , customertype varchar(4)
  1147. , pricelevel varchar(1)
  1148. , datelastactivity date
  1149. , datelastpayment date
  1150. , datelaststatement date
  1151. , datelastfinancechrg date
  1152. , datelastaging date
  1153. , defaultitemcode varchar(30)
  1154. , credithold varchar(1)
  1155. , primaryshiptocode varchar(4)
  1156. , dateestablished date
  1157. , defaultpaymenttype varchar(5)
  1158. , emailstatements varchar(1)
  1159. , numberofinvtouseincalc numeric(15,4)
  1160. , avgdayspaymentinvoice numeric(15,4)
  1161. , avgdaysoverdue numeric(15,4)
  1162. , customerdiscountrate numeric(15,4)
  1163. , servicechargerate numeric(15,4)
  1164. , creditlimit numeric(15,4)
  1165. , lastpaymentamt numeric(15,4)
  1166. , higheststmntbalance numeric(15,4)
  1167. , unpaidservicechrg numeric(15,4)
  1168. , balanceforward numeric(15,4)
  1169. , currentbalance numeric(15,4)
  1170. , agingcategory1 numeric(15,4)
  1171. , agingcategory2 numeric(15,4)
  1172. , agingcategory3 numeric(15,4)
  1173. , agingcategory4 numeric(15,4)
  1174. , openorderamt numeric(15,4)
  1175. , retentioncurrent numeric(15,4)
  1176. , retentionaging1 numeric(15,4)
  1177. , retentionaging2 numeric(15,4)
  1178. , retentionaging3 numeric(15,4)
  1179. , retentionaging4 numeric(15,4)
  1180. , datecreated date
  1181. , timecreated varchar(8)
  1182. , usercreatedkey varchar(10)
  1183. , dateupdated date
  1184. , timeupdated varchar(8)
  1185. , userupdatedkey varchar(10)
  1186. , salespersondivisionno2 varchar(2)
  1187. , salespersonno2 varchar(4)
  1188. , salespersondivisionno3 varchar(2)
  1189. , salespersonno3 varchar(4)
  1190. , salespersondivisionno4 varchar(2)
  1191. , salespersonno4 varchar(4)
  1192. , salespersondivisionno5 varchar(2)
  1193. , salespersonno5 varchar(4)
  1194. , customerstatus varchar(1)
  1195. , inactivereasoncode varchar(5)
  1196. , usesagecloudforinvprinting varchar(1)
  1197. , defaultcostcode varchar(9)
  1198. , defaultcosttype varchar(1)
  1199. , creditcardguid varchar(32)
  1200. , splitcommrate2 numeric(15,4)
  1201. , splitcommrate3 numeric(15,4)
  1202. , splitcommrate4 numeric(15,4)
  1203. , splitcommrate5 numeric(15,4)
  1204. , CONSTRAINT rar_customer_KEY0_pk PRIMARY KEY (ardivisionno,customerno)
  1205. , CONSTRAINT rar_customer_KEY0_check CHECK (ardivisionno is not null and customerno IS NOT NULL)
  1206. ) WITH (OIDS=FALSE);
  1207. CREATE INDEX rar_customer_KEY1_index ON sageimport.rar_customer (customername,ardivisionno,customerno);
  1208. CREATE INDEX rar_customer_KEY10_index ON sageimport.rar_customer (addressline3,ardivisionno,customerno);
  1209. CREATE INDEX rar_customer_KEY2_index ON sageimport.rar_customer (sortfield,ardivisionno,customerno);
  1210. CREATE INDEX rar_customer_KEY3_index ON sageimport.rar_customer (ardivisionno,salespersonno,customerno);
  1211. CREATE INDEX rar_customer_KEY4_index ON sageimport.rar_customer (customertype,ardivisionno,customerno);
  1212. CREATE INDEX rar_customer_KEY5_index ON sageimport.rar_customer (zipcode,ardivisionno,customerno);
  1213. CREATE INDEX rar_customer_KEY6_index ON sageimport.rar_customer (telephoneno,ardivisionno,customerno);
  1214. CREATE INDEX rar_customer_KEY7_index ON sageimport.rar_customer (customerno);
  1215. CREATE INDEX rar_customer_KEY8_index ON sageimport.rar_customer (addressline1,ardivisionno,customerno);
  1216. CREATE INDEX rar_customer_KEY9_index ON sageimport.rar_customer (addressline2,ardivisionno,customerno);
  1217.  
  1218.  
  1219. CREATE TABLE sageimport.rar_customercontact(
  1220. ardivisionno varchar(2)
  1221. , customerno varchar(20)
  1222. , contactcode varchar(10)
  1223. , contactname varchar(30)
  1224. , addressline1 varchar(30)
  1225. , addressline2 varchar(30)
  1226. , addressline3 varchar(30)
  1227. , city varchar(20)
  1228. , state varchar(2)
  1229. , zipcode varchar(10)
  1230. , countrycode varchar(3)
  1231. , salutation varchar(10)
  1232. , contacttitle varchar(15)
  1233. , telephoneno1 varchar(17)
  1234. , telephoneext1 varchar(5)
  1235. , telephoneno2 varchar(17)
  1236. , telephoneext2 varchar(5)
  1237. , faxno varchar(17)
  1238. , emailaddress varchar(50)
  1239. , contactnotes text
  1240. , ebmuserid varchar(15)
  1241. , datecreated date
  1242. , timecreated varchar(8)
  1243. , usercreatedkey varchar(10)
  1244. , dateupdated date
  1245. , timeupdated varchar(8)
  1246. , userupdatedkey varchar(10)
  1247. , CONSTRAINT rar_customercontact_KEY0_pk PRIMARY KEY (ardivisionno,customerno,contactcode)
  1248. , CONSTRAINT rar_customercontact_KEY0_check CHECK (ardivisionno is not null and customerno is not null and contactcode IS NOT NULL)
  1249. ) WITH (OIDS=FALSE);
  1250. CREATE INDEX rar_customercontact_KEY1_index ON sageimport.rar_customercontact (contactname,ardivisionno,customerno,contactcode);
  1251. CREATE INDEX rar_customercontact_KEY2_index ON sageimport.rar_customercontact (addressline1,ardivisionno,customerno,contactcode);
  1252. CREATE INDEX rar_customercontact_KEY3_index ON sageimport.rar_customercontact (addressline2,ardivisionno,customerno,contactcode);
  1253. CREATE INDEX rar_customercontact_KEY4_index ON sageimport.rar_customercontact (addressline3,ardivisionno,customerno,contactcode);
  1254. CREATE INDEX rar_customercontact_KEY5_index ON sageimport.rar_customercontact (zipcode,ardivisionno,customerno,contactcode);
  1255. CREATE INDEX rar_customercontact_KEY6_index ON sageimport.rar_customercontact (telephoneno1,ardivisionno,customerno,contactcode);
  1256. CREATE INDEX rar_customercontact_KEY7_index ON sageimport.rar_customercontact (telephoneno2,ardivisionno,customerno,contactcode);
  1257. CREATE INDEX rar_customercontact_KEY8_index ON sageimport.rar_customercontact (emailaddress,ardivisionno,customerno,contactcode);
  1258.  
  1259.  
  1260. CREATE TABLE sageimport.rar_customercreditcard(
  1261. ardivisionno varchar(2)
  1262. , customerno varchar(20)
  1263. , paymenttype varchar(5)
  1264. , expirationdateyear varchar(4)
  1265. , expirationdatemonth varchar(2)
  1266. , corporatecustidpurchorder varchar(17)
  1267. , cardholdername varchar(30)
  1268. , avscity varchar(20)
  1269. , avsstate varchar(2)
  1270. , avszipcode varchar(10)
  1271. , creditcardcomment varchar(30)
  1272. , ebmenabled varchar(1)
  1273. , last4unencryptedcreditcardnos varchar(4)
  1274. , datecreated date
  1275. , timecreated varchar(8)
  1276. , usercreatedkey varchar(10)
  1277. , dateupdated date
  1278. , timeupdated varchar(8)
  1279. , userupdatedkey varchar(10)
  1280. , creditcardguid varchar(32)
  1281. , creditcardid varchar(10)
  1282. , cardtype varchar(1)
  1283. , bankaccounttype varchar(1)
  1284. , bankname varchar(30)
  1285. , avsaddressline1 varchar(30)
  1286. , avsaddressline2 varchar(30)
  1287. , avscountrycode varchar(3)
  1288. , emailaddress varchar(250)
  1289. , last4bankroutingnos varchar(4)
  1290. , last4bankaccountnos varchar(4)
  1291. , CONSTRAINT rar_customercreditcard_KEY0_pk PRIMARY KEY (ardivisionno,customerno,creditcardguid)
  1292. , CONSTRAINT rar_customercreditcard_KEY0_check CHECK (ardivisionno is not null and customerno is not null and creditcardguid IS NOT NULL)
  1293. , CONSTRAINT rar_customercreditcard_KEY5_unique UNIQUE (ardivisionno,customerno,creditcardid)
  1294. ) WITH (OIDS=FALSE);
  1295. CREATE INDEX rar_customercreditcard_KEY1_index ON sageimport.rar_customercreditcard (paymenttype,ardivisionno,customerno,creditcardid,creditcardguid);
  1296. CREATE INDEX rar_customercreditcard_KEY2_index ON sageimport.rar_customercreditcard (expirationdateyear,expirationdatemonth,ardivisionno,customerno,creditcardguid);
  1297. CREATE INDEX rar_customercreditcard_KEY3_index ON sageimport.rar_customercreditcard (ardivisionno,customerno,paymenttype,creditcardid,creditcardguid);
  1298. CREATE INDEX rar_customercreditcard_KEY4_index ON sageimport.rar_customercreditcard (ardivisionno,customerno,creditcardid,creditcardguid);
  1299.  
  1300.  
  1301. CREATE TABLE sageimport.rar_customerdocumentcontacts(
  1302. ardivisionno varchar(2)
  1303. , customerno varchar(20)
  1304. , document varchar(30)
  1305. , linekey varchar(6)
  1306. , lineseqno varchar(14)
  1307. , recordtype varchar(1)
  1308. , tocontactcode varchar(10)
  1309. , toadditionalemailaddress varchar(50)
  1310. , toadditionalfaxno varchar(17)
  1311. , toadditionalfaxrecipientname varchar(30)
  1312. , datecreated date
  1313. , timecreated varchar(8)
  1314. , usercreatedkey varchar(10)
  1315. , dateupdated date
  1316. , timeupdated varchar(8)
  1317. , userupdatedkey varchar(10)
  1318. , CONSTRAINT rar_customerdocumentcontacts_KEY0_pk PRIMARY KEY (ardivisionno,customerno,document,linekey)
  1319. , CONSTRAINT rar_customerdocumentcontacts_KEY0_check CHECK (ardivisionno is not null and customerno is not null and document is not null and linekey IS NOT NULL)
  1320. ) WITH (OIDS=FALSE);
  1321. CREATE INDEX rar_customerdocumentcontacts_KEY1_index ON sageimport.rar_customerdocumentcontacts (ardivisionno,customerno,document,lineseqno,linekey);
  1322. CREATE INDEX rar_customerdocumentcontacts_KEY2_index ON sageimport.rar_customerdocumentcontacts (ardivisionno,customerno,document,recordtype,toadditionalemailaddress,toadditionalfaxrecipientname,tocontactcode,linekey);
  1323.  
  1324.  
  1325. CREATE TABLE sageimport.rar_customerdocuments(
  1326. ardivisionno varchar(2)
  1327. , customerno varchar(20)
  1328. , document varchar(30)
  1329. , printdocument varchar(1)
  1330. , emaildocument varchar(1)
  1331. , faxdocument varchar(1)
  1332. , documentpassword varchar(33)
  1333. , useemailaddressindataentry varchar(1)
  1334. , usecustomeremailaddress varchar(1)
  1335. , usefaxnoindataentry varchar(1)
  1336. , usecustomerfaxno varchar(1)
  1337. , datecreated date
  1338. , timecreated varchar(8)
  1339. , usercreatedkey varchar(10)
  1340. , dateupdated date
  1341. , timeupdated varchar(8)
  1342. , userupdatedkey varchar(10)
  1343. , CONSTRAINT rar_customerdocuments_KEY0_pk PRIMARY KEY (ardivisionno,customerno,document)
  1344. , CONSTRAINT rar_customerdocuments_KEY0_check CHECK (ardivisionno is not null and customerno is not null and document IS NOT NULL)
  1345. ) WITH (OIDS=FALSE);
  1346.  
  1347.  
  1348. CREATE TABLE sageimport.rar_customermemo(
  1349. ardivisionno varchar(2)
  1350. , customerno varchar(20)
  1351. , memocode varchar(10)
  1352. , seqno varchar(6)
  1353. , memodesc varchar(30)
  1354. , memodate date
  1355. , expirationdate date
  1356. , reminderstartdate date
  1357. , reminderenddate date
  1358. , autodisplaysetting varchar(1)
  1359. , memotext text
  1360. , attachment varchar(128)
  1361. , originalmodulecode varchar(3)
  1362. , originalmemotype varchar(2)
  1363. , datecreated date
  1364. , timecreated varchar(8)
  1365. , usercreatedkey varchar(10)
  1366. , dateupdated date
  1367. , timeupdated varchar(8)
  1368. , userupdatedkey varchar(10)
  1369. , CONSTRAINT rar_customermemo_KEY0_pk PRIMARY KEY (ardivisionno,customerno,memocode,seqno)
  1370. , CONSTRAINT rar_customermemo_KEY0_check CHECK (ardivisionno is not null and customerno is not null and memocode is not null and seqno IS NOT NULL)
  1371. ) WITH (OIDS=FALSE);
  1372. CREATE INDEX rar_customermemo_KEY1_index ON sageimport.rar_customermemo (memocode,ardivisionno,customerno);
  1373.  
  1374.  
  1375. CREATE TABLE sageimport.rar_customerpdflog(
  1376. ardivisionno varchar(2)
  1377. , customerno varchar(20)
  1378. , document varchar(60)
  1379. , modulecode varchar(3)
  1380. , documentkey varchar(9)
  1381. , documentdate date
  1382. , sequence varchar(3)
  1383. , invoiceno varchar(7)
  1384. , invoicetype varchar(2)
  1385. , salesorderno varchar(7)
  1386. , ordertype varchar(1)
  1387. , jobno varchar(7)
  1388. , accountingdate date
  1389. , directory varchar(150)
  1390. , filename varchar(100)
  1391. , sent varchar(1)
  1392. , updated varchar(1)
  1393. , passwordprotected varchar(1)
  1394. , password varchar(33)
  1395. , datecreated date
  1396. , timecreated varchar(8)
  1397. , usercreatedkey varchar(10)
  1398. , CONSTRAINT rar_customerpdflog_KEY0_pk PRIMARY KEY (ardivisionno,customerno,document,modulecode,documentkey,documentdate,sequence)
  1399. , CONSTRAINT rar_customerpdflog_KEY0_check CHECK (ardivisionno is not null and customerno is not null and document is not null and modulecode is not null and documentkey is not null and documentdate is not null and sequence IS NOT NULL)
  1400. ) WITH (OIDS=FALSE);
  1401. CREATE INDEX rar_customerpdflog_KEY1_index ON sageimport.rar_customerpdflog (filename,ardivisionno,customerno,document,modulecode,documentkey,documentdate,sequence);
  1402. CREATE INDEX rar_customerpdflog_KEY2_index ON sageimport.rar_customerpdflog (jobno,ardivisionno,customerno,document,modulecode,documentkey,documentdate,sequence);
  1403. CREATE INDEX rar_customerpdflog_KEY3_index ON sageimport.rar_customerpdflog (documentdate,ardivisionno,customerno,document,modulecode,documentkey,sequence);
  1404.  
  1405.  
  1406. CREATE TABLE sageimport.rar_customersaleshistory(
  1407. ardivisionno varchar(2)
  1408. , customerno varchar(20)
  1409. , fiscalyear varchar(4)
  1410. , fiscalperiod varchar(2)
  1411. , dollarssold numeric(15,4)
  1412. , costofgoodssold numeric(15,4)
  1413. , cashreceived numeric(15,4)
  1414. , financecharges numeric(15,4)
  1415. , numberofinvoices numeric(15,4)
  1416. , numberoffinancechrgs numeric(15,4)
  1417. , dateupdated date
  1418. , timeupdated varchar(8)
  1419. , userupdatedkey varchar(10)
  1420. , CONSTRAINT rar_customersaleshistory_KEY0_pk PRIMARY KEY (ardivisionno,customerno,fiscalyear,fiscalperiod)
  1421. , CONSTRAINT rar_customersaleshistory_KEY0_check CHECK (ardivisionno is not null and customerno is not null and fiscalyear is not null and fiscalperiod IS NOT NULL)
  1422. ) WITH (OIDS=FALSE);
  1423. CREATE INDEX rar_customersaleshistory_KEY1_index ON sageimport.rar_customersaleshistory (fiscalyear,fiscalperiod,ardivisionno,customerno);
  1424. CREATE INDEX rar_customersaleshistory_KEY2_index ON sageimport.rar_customersaleshistory (fiscalyear,fiscalperiod,ardivisionno,customerno);
  1425.  
  1426.  
  1427. CREATE TABLE sageimport.rar_customersalespersonhistory(
  1428. salespersondivisionno varchar(2)
  1429. , salespersonno varchar(4)
  1430. , ardivisionno varchar(2)
  1431. , customerno varchar(20)
  1432. , fiscalyear varchar(4)
  1433. , fiscalperiod varchar(2)
  1434. , dollarssold numeric(15,4)
  1435. , costofgoodssold numeric(15,4)
  1436. , dateupdated date
  1437. , timeupdated varchar(8)
  1438. , userupdatedkey varchar(10)
  1439. , CONSTRAINT rar_customersalespersonhistory_KEY0_pk PRIMARY KEY (salespersondivisionno,salespersonno,ardivisionno,customerno,fiscalyear,fiscalperiod)
  1440. , CONSTRAINT rar_customersalespersonhistory_KEY0_check CHECK (salespersondivisionno is not null and salespersonno is not null and ardivisionno is not null and customerno is not null and fiscalyear is not null and fiscalperiod IS NOT NULL)
  1441. ) WITH (OIDS=FALSE);
  1442. CREATE INDEX rar_customersalespersonhistory_KEY1_index ON sageimport.rar_customersalespersonhistory (fiscalyear,fiscalperiod,salespersondivisionno,salespersonno,ardivisionno,customerno);
  1443. CREATE INDEX rar_customersalespersonhistory_KEY2_index ON sageimport.rar_customersalespersonhistory (fiscalyear,fiscalperiod,salespersondivisionno,salespersonno,ardivisionno,customerno);
  1444. CREATE INDEX rar_customersalespersonhistory_KEY3_index ON sageimport.rar_customersalespersonhistory (ardivisionno,customerno,salespersondivisionno,salespersonno,fiscalyear,fiscalperiod);
  1445.  
  1446.  
  1447. CREATE TABLE sageimport.rar_customershiptotaxexemptions(
  1448. ardivisionno varchar(2)
  1449. , customerno varchar(20)
  1450. , shiptocode varchar(4)
  1451. , taxcode varchar(15)
  1452. , taxexemptionno varchar(20)
  1453. , CONSTRAINT rar_customershiptotaxexemptions_KEY0_pk PRIMARY KEY (ardivisionno,customerno,shiptocode,taxcode)
  1454. , CONSTRAINT rar_customershiptotaxexemptions_KEY0_check CHECK (ardivisionno is not null and customerno is not null and shiptocode is not null and taxcode IS NOT NULL)
  1455. ) WITH (OIDS=FALSE);
  1456.  
  1457.  
  1458. CREATE TABLE sageimport.rar_dailypostingwork(
  1459. postingdate date
  1460. , sourcejournal varchar(2)
  1461. , registerno varchar(6)
  1462. , accountkey varchar(9)
  1463. , sequenceno varchar(14)
  1464. , sourcemodule varchar(2)
  1465. , postingcomment text
  1466. , documenttype varchar(1)
  1467. , documentno varchar(10)
  1468. , docsequenceno varchar(14)
  1469. , receiptno varchar(7)
  1470. , batchtype varchar(2)
  1471. , batchno varchar(5)
  1472. , lineseqno varchar(14)
  1473. , apdivisionno varchar(2)
  1474. , vendorno varchar(7)
  1475. , ardivisionno varchar(2)
  1476. , customerno varchar(20)
  1477. , debitamount numeric(15,4)
  1478. , creditamount numeric(15,4)
  1479. , altdoctype varchar(1)
  1480. , CONSTRAINT rar_dailypostingwork_KEY0_pk PRIMARY KEY (postingdate,sourcejournal,registerno,accountkey,sequenceno)
  1481. , CONSTRAINT rar_dailypostingwork_KEY0_check CHECK (postingdate is not null and sourcejournal is not null and registerno is not null and accountkey is not null and sequenceno IS NOT NULL)
  1482. , CONSTRAINT rar_dailypostingwork_KEY1_unique UNIQUE (sequenceno)
  1483. ) WITH (OIDS=FALSE);
  1484. CREATE INDEX rar_dailypostingwork_KEY2_index ON sageimport.rar_dailypostingwork (registerno,postingdate,sourcejournal,accountkey,sequenceno);
  1485. CREATE INDEX rar_dailypostingwork_KEY3_index ON sageimport.rar_dailypostingwork (accountkey,postingdate,sourcejournal,registerno,sequenceno);
  1486.  
  1487.  
  1488. CREATE TABLE sageimport.rar_deletechangecustomers(
  1489. lineno varchar(14)
  1490. , startingardivisionno varchar(2)
  1491. , startingcustomerno varchar(20)
  1492. , endingardivisionno varchar(2)
  1493. , newardivisionno varchar(2)
  1494. , endingcustomerno varchar(20)
  1495. , newcustomerno varchar(20)
  1496. , operation varchar(1)
  1497. , allfiles varchar(1)
  1498. , deleterepetitiveinvoices varchar(1)
  1499. , deletecontacts varchar(1)
  1500. , deletecreditcards varchar(1)
  1501. , deleteebmcreditcards varchar(1)
  1502. , deletesalesorders varchar(1)
  1503. , deleteshipto varchar(1)
  1504. , deleteebmcustomer varchar(1)
  1505. , deleterma varchar(1)
  1506. , CONSTRAINT rar_deletechangecustomers_KEY0_pk PRIMARY KEY (operation,lineno)
  1507. , CONSTRAINT rar_deletechangecustomers_KEY0_check CHECK (operation is not null and lineno IS NOT NULL)
  1508. ) WITH (OIDS=FALSE);
  1509.  
  1510.  
  1511. CREATE TABLE sageimport.rar_deletechangecustomerswork(
  1512. lineno varchar(14)
  1513. , sequenceno varchar(14)
  1514. , sourceprefix varchar(2)
  1515. , sourceprimary varchar(20)
  1516. , destinationprefix varchar(2)
  1517. , destinationprimary varchar(20)
  1518. , changestatus text
  1519. , operation varchar(1)
  1520. , allfiles varchar(1)
  1521. , deleterepetitiveinvoices varchar(1)
  1522. , deletecontacts varchar(1)
  1523. , deletecreditcards varchar(1)
  1524. , deleteebmcreditcards varchar(1)
  1525. , deletesalesorders varchar(1)
  1526. , deleteshipto varchar(1)
  1527. , deleteebmcustomer varchar(1)
  1528. , deleterma varchar(1)
  1529. , startingardivisionno varchar(2)
  1530. , startingcustomerno varchar(20)
  1531. , endingardivisionno varchar(2)
  1532. , endingcustomerno varchar(20)
  1533. , newardivisionno varchar(2)
  1534. , newcustomerno varchar(20)
  1535. , CONSTRAINT rar_deletechangecustomerswork_KEY0_pk PRIMARY KEY (operation,lineno,sequenceno)
  1536. , CONSTRAINT rar_deletechangecustomerswork_KEY0_check CHECK (operation is not null and lineno is not null and sequenceno IS NOT NULL)
  1537. ) WITH (OIDS=FALSE);
  1538. CREATE INDEX rar_deletechangecustomerswork_KEY1_index ON sageimport.rar_deletechangecustomerswork (sourceprefix,sourceprimary,destinationprefix,destinationprimary,lineno);
  1539.  
  1540.  
  1541. CREATE TABLE sageimport.rar_deposithistory(
  1542. paymenttype varchar(5)
  1543. , invoiceno varchar(7)
  1544. , sequenceno varchar(6)
  1545. , ardivisionno varchar(2)
  1546. , customerno varchar(20)
  1547. , transactiondate date
  1548. , invoicedate date
  1549. , invoicetype varchar(2)
  1550. , salesorderno varchar(7)
  1551. , referenceno varchar(24)
  1552. , checkno varchar(10)
  1553. , last4unencryptedcreditcardnos varchar(4)
  1554. , expirationdateyear varchar(4)
  1555. , expirationdatemonth varchar(2)
  1556. , creditcardauthorizationno varchar(16)
  1557. , creditcardtransactionid varchar(10)
  1558. , transactionamt numeric(15,4)
  1559. , dateupdated date
  1560. , timeupdated varchar(8)
  1561. , userupdatedkey varchar(10)
  1562. , creditcardid varchar(10)
  1563. , cardtype varchar(1)
  1564. , bankaccounttype varchar(1)
  1565. , creditcardentryno varchar(6)
  1566. , last4bankroutingnos varchar(4)
  1567. , last4bankaccountnos varchar(4)
  1568. , CONSTRAINT rar_deposithistory_KEY0_pk PRIMARY KEY (paymenttype,invoiceno,sequenceno)
  1569. , CONSTRAINT rar_deposithistory_KEY0_check CHECK (paymenttype is not null and invoiceno is not null and sequenceno IS NOT NULL)
  1570. ) WITH (OIDS=FALSE);
  1571. CREATE INDEX rar_deposithistory_KEY1_index ON sageimport.rar_deposithistory (ardivisionno,customerno);
  1572. CREATE INDEX rar_deposithistory_KEY2_index ON sageimport.rar_deposithistory (transactiondate,paymenttype,invoiceno,sequenceno);
  1573. CREATE INDEX rar_deposithistory_KEY3_index ON sageimport.rar_deposithistory (expirationdateyear,expirationdatemonth,paymenttype,invoiceno,sequenceno);
  1574. CREATE INDEX rar_deposithistory_KEY4_index ON sageimport.rar_deposithistory (invoicedate,paymenttype,invoiceno,sequenceno);
  1575.  
  1576.  
  1577. CREATE TABLE sageimport.rar_division(
  1578. ardivisionno varchar(2)
  1579. , ardivisiondesc varchar(30)
  1580. , accountsreceivableacctkey varchar(9)
  1581. , cashacctkey varchar(9)
  1582. , discountsallowedacctkey varchar(9)
  1583. , freightacctkey varchar(9)
  1584. , salestaxacctkey varchar(9)
  1585. , financechrgacctkey varchar(9)
  1586. , retentionreceivableacctkey varchar(9)
  1587. , postsalestoglsubacct varchar(15)
  1588. , datecreated date
  1589. , timecreated varchar(8)
  1590. , usercreatedkey varchar(10)
  1591. , dateupdated date
  1592. , timeupdated varchar(8)
  1593. , userupdatedkey varchar(10)
  1594. , CONSTRAINT rar_division_KEY0_pk PRIMARY KEY (ardivisionno)
  1595. , CONSTRAINT rar_division_KEY0_check CHECK (ardivisionno IS NOT NULL)
  1596. ) WITH (OIDS=FALSE);
  1597.  
  1598.  
  1599. CREATE TABLE sageimport.rar_invoicehistorydetail(
  1600. invoiceno varchar(7)
  1601. , headerseqno varchar(6)
  1602. , detailseqno varchar(6)
  1603. , itemcode varchar(30)
  1604. , itemtype varchar(1)
  1605. , itemcodedesc varchar(30)
  1606. , extendeddescriptionkey varchar(10)
  1607. , salesacctkey varchar(9)
  1608. , costofgoodssoldacctkey varchar(9)
  1609. , inventoryacctkey varchar(9)
  1610. , unitofmeasure varchar(4)
  1611. , subjecttoexemption varchar(1)
  1612. , commissionable varchar(1)
  1613. , taxclass varchar(2)
  1614. , discount varchar(1)
  1615. , dropship varchar(1)
  1616. , warehousecode varchar(3)
  1617. , pricelevel varchar(1)
  1618. , productline varchar(4)
  1619. , valuation varchar(1)
  1620. , priceoverridden varchar(1)
  1621. , orderwarehouse varchar(3)
  1622. , revision varchar(3)
  1623. , billoption1 varchar(2)
  1624. , billoption2 varchar(2)
  1625. , billoption3 varchar(2)
  1626. , billoption4 varchar(2)
  1627. , billoption5 varchar(2)
  1628. , billoption6 varchar(2)
  1629. , billoption7 varchar(2)
  1630. , billoption8 varchar(2)
  1631. , billoption9 varchar(2)
  1632. , kititem varchar(1)
  1633. , explodedkititem varchar(1)
  1634. , skipprintcompline varchar(1)
  1635. , standardkitbill varchar(1)
  1636. , aliasitemno varchar(30)
  1637. , customeraction varchar(1)
  1638. , itemaction varchar(1)
  1639. , warrantycode varchar(10)
  1640. , expirationdate date
  1641. , expirationoverridden varchar(1)
  1642. , costcode varchar(9)
  1643. , costtype varchar(1)
  1644. , commenttext text
  1645. , promisedate date
  1646. , quantityshipped numeric(15,4)
  1647. , quantityordered numeric(15,4)
  1648. , quantitybackordered numeric(15,4)
  1649. , unitprice numeric(15,4)
  1650. , unitcost numeric(15,4)
  1651. , unitofmeasureconvfactor numeric(15,4)
  1652. , commissionamt numeric(15,4)
  1653. , linediscountpercent numeric(15,4)
  1654. , quantityperbill numeric(15,4)
  1655. , extensionamt numeric(15,4)
  1656. , udf_primary_item varchar(1)
  1657. , apdivisionno varchar(2)
  1658. , vendorno varchar(7)
  1659. , purchaseorderno varchar(7)
  1660. , purchaseorderrequireddate date
  1661. , commoditycode varchar(12)
  1662. , alternatetaxidentifier varchar(15)
  1663. , taxtypeapplied varchar(4)
  1664. , netgrossindicator varchar(1)
  1665. , debitcreditindicator varchar(1)
  1666. , taxamt numeric(15,4)
  1667. , taxrate numeric(15,4)
  1668. , CONSTRAINT rar_invoicehistorydetail_KEY0_pk PRIMARY KEY (invoiceno,headerseqno,detailseqno)
  1669. , CONSTRAINT rar_invoicehistorydetail_KEY0_check CHECK (invoiceno is not null and headerseqno is not null and detailseqno IS NOT NULL)
  1670. ) WITH (OIDS=FALSE);
  1671. CREATE INDEX rar_invoicehistorydetail_KEY1_index ON sageimport.rar_invoicehistorydetail (extendeddescriptionkey,invoiceno,headerseqno,detailseqno);
  1672. CREATE INDEX rar_invoicehistorydetail_KEY2_index ON sageimport.rar_invoicehistorydetail (apdivisionno,vendorno,invoiceno,headerseqno,detailseqno);
  1673.  
  1674.  
  1675. CREATE TABLE sageimport.rar_invoicehistoryheader(
  1676. invoiceno varchar(7)
  1677. , headerseqno varchar(6)
  1678. , modulecode varchar(3)
  1679. , invoicetype varchar(2)
  1680. , invoicedate date
  1681. , transactiondate date
  1682. , ardivisionno varchar(2)
  1683. , customerno varchar(20)
  1684. , termscode varchar(2)
  1685. , taxschedule varchar(9)
  1686. , taxexemptno varchar(15)
  1687. , salespersondivisionno varchar(2)
  1688. , salespersonno varchar(4)
  1689. , customerpono varchar(30)
  1690. , applytoinvoiceno varchar(7)
  1691. , comment varchar(30)
  1692. , repetitiveinvoicerefno varchar(4)
  1693. , jobno varchar(7)
  1694. , invoiceduedate date
  1695. , discountduedate date
  1696. , sourcejournal varchar(2)
  1697. , journalnoglbatchno varchar(6)
  1698. , batchfax varchar(1)
  1699. , faxno varchar(17)
  1700. , shippinginvoice varchar(1)
  1701. , salesorderno varchar(7)
  1702. , ordertype varchar(1)
  1703. , orderdate date
  1704. , billtoname varchar(30)
  1705. , billtoaddress1 varchar(30)
  1706. , billtoaddress2 varchar(30)
  1707. , billtoaddress3 varchar(30)
  1708. , billtocity varchar(20)
  1709. , billtostate varchar(2)
  1710. , billtozipcode varchar(10)
  1711. , billtocountrycode varchar(3)
  1712. , shiptocode varchar(4)
  1713. , shiptoname varchar(30)
  1714. , shiptoaddress1 varchar(30)
  1715. , shiptoaddress2 varchar(30)
  1716. , shiptoaddress3 varchar(30)
  1717. , shiptocity varchar(20)
  1718. , shiptostate varchar(2)
  1719. , shiptozipcode varchar(10)
  1720. , shiptocountrycode varchar(3)
  1721. , shipdate date
  1722. , shipvia varchar(15)
  1723. , shipzone varchar(5)
  1724. , fob varchar(15)
  1725. , confirmto varchar(30)
  1726. , checknofordeposit varchar(10)
  1727. , splitcommissions varchar(1)
  1728. , salespersondivisionno2 varchar(2)
  1729. , salespersonno2 varchar(4)
  1730. , salespersondivisionno3 varchar(2)
  1731. , salespersonno3 varchar(4)
  1732. , salespersondivisionno4 varchar(2)
  1733. , salespersonno4 varchar(4)
  1734. , salespersondivisionno5 varchar(2)
  1735. , salespersonno5 varchar(4)
  1736. , paymenttype varchar(5)
  1737. , paymenttypecategory varchar(1)
  1738. , otherpaymenttyperefno varchar(24)
  1739. , rmano varchar(7)
  1740. , ebmsubmissiontype varchar(1)
  1741. , ebmuseridsubmittingthisorder varchar(15)
  1742. , ebmusertype varchar(1)
  1743. , shipperid varchar(3)
  1744. , userkey varchar(10)
  1745. , warehousecode varchar(3)
  1746. , shipweight varchar(5)
  1747. , residentialaddress varchar(1)
  1748. , emailaddress varchar(250)
  1749. , crmuserid varchar(11)
  1750. , crmcompanyid varchar(11)
  1751. , crmpersonid varchar(11)
  1752. , crmopportunityid varchar(11)
  1753. , taxablesalesamt numeric(15,4)
  1754. , nontaxablesalesamt numeric(15,4)
  1755. , freightamt numeric(15,4)
  1756. , salestaxamt numeric(15,4)
  1757. , costofsalesamt numeric(15,4)
  1758. , amountsubjecttodiscount numeric(15,4)
  1759. , discountrate numeric(15,4)
  1760. , discountamt numeric(15,4)
  1761. , salessubjecttocomm numeric(15,4)
  1762. , costsubjecttocomm numeric(15,4)
  1763. , commissionrate numeric(15,4)
  1764. , commissionamt numeric(15,4)
  1765. , splitcommrate2 numeric(15,4)
  1766. , splitcommrate3 numeric(15,4)
  1767. , splitcommrate4 numeric(15,4)
  1768. , splitcommrate5 numeric(15,4)
  1769. , depositamt numeric(15,4)
  1770. , weight numeric(15,4)
  1771. , retentionamt numeric(15,4)
  1772. , numberofpackages numeric(15,4)
  1773. , dateupdated date
  1774. , timeupdated varchar(8)
  1775. , userupdatedkey varchar(10)
  1776. , udf_project varchar(15)
  1777. , billtodivisionno varchar(2)
  1778. , billtocustomerno varchar(20)
  1779. , datecreated date
  1780. , timecreated varchar(8)
  1781. , usercreatedkey varchar(10)
  1782. , CONSTRAINT rar_invoicehistoryheader_KEY0_pk PRIMARY KEY (invoiceno,headerseqno)
  1783. , CONSTRAINT rar_invoicehistoryheader_KEY0_check CHECK (invoiceno is not null and headerseqno IS NOT NULL)
  1784. ) WITH (OIDS=FALSE);
  1785. CREATE INDEX rar_invoicehistoryheader_KEY1_index ON sageimport.rar_invoicehistoryheader (ardivisionno,customerno,invoiceno,headerseqno);
  1786. CREATE INDEX rar_invoicehistoryheader_KEY10_index ON sageimport.rar_invoicehistoryheader (ardivisionno,customerno,customerpono,invoiceno,headerseqno);
  1787. CREATE INDEX rar_invoicehistoryheader_KEY11_index ON sageimport.rar_invoicehistoryheader (shiptocode,invoiceno,headerseqno);
  1788. CREATE INDEX rar_invoicehistoryheader_KEY12_index ON sageimport.rar_invoicehistoryheader (shiptozipcode,invoiceno,headerseqno);
  1789. CREATE INDEX rar_invoicehistoryheader_KEY13_index ON sageimport.rar_invoicehistoryheader (comment,invoiceno,headerseqno);
  1790. CREATE INDEX rar_invoicehistoryheader_KEY14_index ON sageimport.rar_invoicehistoryheader (billtodivisionno,billtocustomerno,invoiceno,headerseqno);
  1791. CREATE INDEX rar_invoicehistoryheader_KEY2_index ON sageimport.rar_invoicehistoryheader (modulecode,salesorderno,invoiceno,headerseqno);
  1792. CREATE INDEX rar_invoicehistoryheader_KEY3_index ON sageimport.rar_invoicehistoryheader (modulecode,billtoname,invoiceno,headerseqno);
  1793. CREATE INDEX rar_invoicehistoryheader_KEY4_index ON sageimport.rar_invoicehistoryheader (modulecode,invoiceno,headerseqno);
  1794. CREATE INDEX rar_invoicehistoryheader_KEY5_index ON sageimport.rar_invoicehistoryheader (customerpono,invoiceno,headerseqno);
  1795. CREATE INDEX rar_invoicehistoryheader_KEY6_index ON sageimport.rar_invoicehistoryheader (shippinginvoice,invoiceno,headerseqno);
  1796. CREATE INDEX rar_invoicehistoryheader_KEY7_index ON sageimport.rar_invoicehistoryheader (salesorderno,invoiceno,headerseqno);
  1797. CREATE INDEX rar_invoicehistoryheader_KEY8_index ON sageimport.rar_invoicehistoryheader (billtoname,invoiceno,headerseqno);
  1798. CREATE INDEX rar_invoicehistoryheader_KEY9_index ON sageimport.rar_invoicehistoryheader (invoicedate,invoiceno,headerseqno);
  1799.  
  1800.  
  1801. CREATE TABLE sageimport.rar_invoicehistorymemo(
  1802. invoiceno varchar(7)
  1803. , headerseqno varchar(6)
  1804. , memocode varchar(10)
  1805. , seqno varchar(6)
  1806. , memodesc varchar(30)
  1807. , memodate date
  1808. , expirationdate date
  1809. , reminderstartdate date
  1810. , reminderenddate date
  1811. , autodisplaysetting varchar(1)
  1812. , attachment varchar(128)
  1813. , memotext text
  1814. , originalmodulecode varchar(3)
  1815. , originalmemotype varchar(2)
  1816. , datecreated date
  1817. , timecreated varchar(8)
  1818. , usercreatedkey varchar(10)
  1819. , dateupdated date
  1820. , timeupdated varchar(8)
  1821. , userupdatedkey varchar(10)
  1822. , CONSTRAINT rar_invoicehistorymemo_KEY0_pk PRIMARY KEY (invoiceno,headerseqno,memocode,seqno)
  1823. , CONSTRAINT rar_invoicehistorymemo_KEY0_check CHECK (invoiceno is not null and headerseqno is not null and memocode is not null and seqno IS NOT NULL)
  1824. ) WITH (OIDS=FALSE);
  1825. CREATE INDEX rar_invoicehistorymemo_KEY1_index ON sageimport.rar_invoicehistorymemo (memocode,invoiceno,headerseqno);
  1826.  
  1827.  
  1828. CREATE TABLE sageimport.rar_invoicehistorypayment(
  1829. invoiceno varchar(7)
  1830. , headerseqno varchar(6)
  1831. , paymentseqno varchar(6)
  1832. , paymenttype varchar(5)
  1833. , paymenttypecategory varchar(1)
  1834. , creditcardid varchar(10)
  1835. , cardtype varchar(1)
  1836. , last4unencryptedcreditcardnos varchar(4)
  1837. , last4bankroutingnos varchar(4)
  1838. , last4bankaccountnos varchar(4)
  1839. , bankname varchar(30)
  1840. , bankaccounttype varchar(1)
  1841. , expirationdateyear varchar(4)
  1842. , expirationdatemonth varchar(2)
  1843. , corporatecustidpurchorder varchar(17)
  1844. , corporatetaxoverrd varchar(1)
  1845. , cardholdername varchar(30)
  1846. , creditcardtransactionid varchar(10)
  1847. , creditcardauthorizationno varchar(16)
  1848. , authorizationdate date
  1849. , authorizationtime varchar(8)
  1850. , avsaddressline1 varchar(30)
  1851. , avsaddressline2 varchar(30)
  1852. , avscity varchar(20)
  1853. , avsstate varchar(2)
  1854. , avszipcode varchar(10)
  1855. , avscountrycode varchar(3)
  1856. , creditcardemailaddress varchar(250)
  1857. , creditcardcomment varchar(30)
  1858. , valueaddedtaxno varchar(13)
  1859. , valueaddedtaxinvoiceno varchar(15)
  1860. , transactionamt numeric(15,4)
  1861. , corporatesalestax numeric(15,4)
  1862. , valueaddedtaxtaxamt numeric(15,4)
  1863. , valueaddedtaxtaxrate numeric(15,4)
  1864. , dutyamt numeric(15,4)
  1865. , nationaltaxamt numeric(15,4)
  1866. , dateupdated date
  1867. , timeupdated varchar(8)
  1868. , userupdatedkey varchar(10)
  1869. , CONSTRAINT rar_invoicehistorypayment_KEY0_pk PRIMARY KEY (invoiceno,headerseqno,paymentseqno)
  1870. , CONSTRAINT rar_invoicehistorypayment_KEY0_check CHECK (invoiceno is not null and headerseqno is not null and paymentseqno IS NOT NULL)
  1871. ) WITH (OIDS=FALSE);
  1872. CREATE INDEX rar_invoicehistorypayment_KEY1_index ON sageimport.rar_invoicehistorypayment (invoiceno,headerseqno,paymenttype,paymentseqno);
  1873. CREATE INDEX rar_invoicehistorypayment_KEY2_index ON sageimport.rar_invoicehistorypayment (expirationdateyear,expirationdatemonth,invoiceno,headerseqno,paymentseqno);
  1874.  
  1875.  
  1876. CREATE TABLE sageimport.rar_invoicehistorytaxsummary(
  1877. invoiceno varchar(7)
  1878. , headerseqno varchar(6)
  1879. , scheduleseqno varchar(6)
  1880. , taxcode varchar(15)
  1881. , exemptionno varchar(20)
  1882. , overridden varchar(1)
  1883. , taxablesalesamt numeric(15,4)
  1884. , nontaxablesalesamt numeric(15,4)
  1885. , taxablefreightamt numeric(15,4)
  1886. , taxabletaxamt numeric(15,4)
  1887. , exemptsalesamt numeric(15,4)
  1888. , salestaxamt numeric(15,4)
  1889. , nontaxablefrghtamt numeric(15,4)
  1890. , CONSTRAINT rar_invoicehistorytaxsummary_KEY0_pk PRIMARY KEY (invoiceno,headerseqno,scheduleseqno,taxcode)
  1891. , CONSTRAINT rar_invoicehistorytaxsummary_KEY0_check CHECK (invoiceno is not null and headerseqno is not null and scheduleseqno is not null and taxcode IS NOT NULL)
  1892. ) WITH (OIDS=FALSE);
  1893.  
  1894.  
  1895. CREATE TABLE sageimport.rar_openinvoice(
  1896. ardivisionno varchar(2)
  1897. , customerno varchar(20)
  1898. , invoiceno varchar(7)
  1899. , invoicetype varchar(2)
  1900. , invoicedate date
  1901. , invoiceduedate date
  1902. , invoicediscountdate date
  1903. , invoicehistoryheaderseqno varchar(6)
  1904. , postingdate date
  1905. , termscode varchar(2)
  1906. , taxschedule varchar(9)
  1907. , salespersondivisionno varchar(2)
  1908. , salespersonno varchar(4)
  1909. , splitcommissionflag varchar(1)
  1910. , comment varchar(30)
  1911. , creditmemoinvoicereference varchar(7)
  1912. , jobno varchar(7)
  1913. , customerpono varchar(30)
  1914. , postingreference varchar(14)
  1915. , checkno varchar(10)
  1916. , commissionrate numeric(15,4)
  1917. , taxableamt numeric(15,4)
  1918. , nontaxableamt numeric(15,4)
  1919. , freightamt numeric(15,4)
  1920. , salestaxamt numeric(15,4)
  1921. , costofsalesamt numeric(15,4)
  1922. , salessubjecttocomm numeric(15,4)
  1923. , costsubjecttocomm numeric(15,4)
  1924. , commissionamt numeric(15,4)
  1925. , discountamt numeric(15,4)
  1926. , paymentstoday numeric(15,4)
  1927. , balance numeric(15,4)
  1928. , retentionamt numeric(15,4)
  1929. , dateupdated date
  1930. , timeupdated varchar(8)
  1931. , userupdatedkey varchar(10)
  1932. , soldtodivisionno varchar(2)
  1933. , soldtocustomerno varchar(20)
  1934. , datecreated date
  1935. , timecreated varchar(8)
  1936. , usercreatedkey varchar(10)
  1937. , CONSTRAINT rar_openinvoice_KEY0_pk PRIMARY KEY (ardivisionno,customerno,invoiceno,invoicetype)
  1938. , CONSTRAINT rar_openinvoice_KEY0_check CHECK (ardivisionno is not null and customerno is not null and invoiceno is not null and invoicetype IS NOT NULL)
  1939. ) WITH (OIDS=FALSE);
  1940. CREATE INDEX rar_openinvoice_KEY1_index ON sageimport.rar_openinvoice (ardivisionno,customerno,invoicedate,invoiceno,invoicetype);
  1941. CREATE INDEX rar_openinvoice_KEY2_index ON sageimport.rar_openinvoice (ardivisionno,customerno,invoicedate,invoiceno,invoicetype);
  1942. CREATE INDEX rar_openinvoice_KEY3_index ON sageimport.rar_openinvoice (invoiceno,invoicetype,ardivisionno,customerno);
  1943. CREATE INDEX rar_openinvoice_KEY4_index ON sageimport.rar_openinvoice (soldtodivisionno,soldtocustomerno,ardivisionno,customerno,invoiceno,invoicetype);
  1944.  
  1945.  
  1946. CREATE TABLE sageimport.rar_openinvoicetaxsummary(
  1947. ardivisionno varchar(2)
  1948. , customerno varchar(20)
  1949. , invoiceno varchar(7)
  1950. , invoicetype varchar(2)
  1951. , scheduleseqno varchar(6)
  1952. , taxcode varchar(15)
  1953. , exemptionno varchar(20)
  1954. , overridden varchar(1)
  1955. , taxablesalesamt numeric(15,4)
  1956. , nontaxablesalesamt numeric(15,4)
  1957. , exemptsalesamt numeric(15,4)
  1958. , taxablefreightamt numeric(15,4)
  1959. , taxabletaxamt numeric(15,4)
  1960. , salestaxamt numeric(15,4)
  1961. , nontaxablefreightamt numeric(15,4)
  1962. , dateupdated date
  1963. , timeupdated varchar(8)
  1964. , userupdatedkey varchar(10)
  1965. , CONSTRAINT rar_openinvoicetaxsummary_KEY0_pk PRIMARY KEY (ardivisionno,customerno,invoiceno,invoicetype,scheduleseqno,taxcode)
  1966. , CONSTRAINT rar_openinvoicetaxsummary_KEY0_check CHECK (ardivisionno is not null and customerno is not null and invoiceno is not null and invoicetype is not null and scheduleseqno is not null and taxcode IS NOT NULL)
  1967. ) WITH (OIDS=FALSE);
  1968.  
  1969.  
  1970. CREATE TABLE sageimport.rar_options(
  1971. modulecode varchar(3)
  1972. , newsystem varchar(1)
  1973. , divisions varchar(1)
  1974. , allowexpandedcustomernumbers varchar(1)
  1975. , postcostofgoodssold varchar(1)
  1976. , postsalesindetail varchar(1)
  1977. , postcashrcptsindetail varchar(1)
  1978. , segmentforsalespostings varchar(1)
  1979. , defaultinvoicedisplay varchar(1)
  1980. , displayinvoiceszerobal varchar(1)
  1981. , currentfiscalyr varchar(4)
  1982. , currentperiod varchar(2)
  1983. , salestaxreporting varchar(1)
  1984. , trackjcretentionrecvbls varchar(1)
  1985. , integrategeneralledger varchar(1)
  1986. , integratebankrec varchar(1)
  1987. , integratejobcost varchar(1)
  1988. , openitembalforward varchar(1)
  1989. , daystoretainpaidinvs numeric(15,4)
  1990. , retaintempcustomers varchar(1)
  1991. , ageinvoicesby varchar(1)
  1992. , agingcategory varchar(1)
  1993. , agingcategory1 numeric(15,4)
  1994. , agingcategory2 numeric(15,4)
  1995. , agingcategory3 numeric(15,4)
  1996. , agingcategory4 numeric(15,4)
  1997. , salespersoncommrpting varchar(1)
  1998. , commissionspaid varchar(1)
  1999. , commissioncalcbasedon varchar(1)
  2000. , updatecommtoothermodules varchar(1)
  2001. , financechargemethod varchar(1)
  2002. , agingcategorycalc varchar(1)
  2003. , excludeexistingfinchrgs varchar(1)
  2004. , creditlimitchecking varchar(1)
  2005. , marginforcrdtlimitwarning numeric(15,4)
  2006. , includeopenorders varchar(1)
  2007. , agingcatforwarning varchar(1)
  2008. , autorecalcaging varchar(1)
  2009. , nextinvoiceno varchar(7)
  2010. , nextdepositno varchar(5)
  2011. , defaultbankcode varchar(1)
  2012. , requiredepositamt varchar(1)
  2013. , allowcreditcard varchar(1)
  2014. , autoincrementcustomerno varchar(1)
  2015. , nextcustomerno varchar(20)
  2016. , printjournalsbydivision varchar(1)
  2017. , pagebreakcshrecptsjrnl varchar(1)
  2018. , printtaxjrnlsindetail varchar(1)
  2019. , printtaxdetailonjrnls varchar(1)
  2020. , printinvoices varchar(1)
  2021. , printcustomerstatements varchar(1)
  2022. , trackcustomerchanges varchar(1)
  2023. , trackadditionsindetail varchar(1)
  2024. , retaindeposittranshist varchar(1)
  2025. , retaindetailedinvhist varchar(1)
  2026. , retaindeletedinvoices varchar(1)
  2027. , retaincommentlines varchar(1)
  2028. , taxfrghtinsaleshist varchar(1)
  2029. , allowpurgeoptioninrecap varchar(1)
  2030. , sequencenoforfc varchar(4)
  2031. , customermask varchar(6)
  2032. , companycode varchar(3)
  2033. , dataversion numeric(15,4)
  2034. , datasublevel numeric(15,4)
  2035. , dayspastduecalc numeric(15,4)
  2036. , financechrgrate numeric(15,4)
  2037. , financechrgamt numeric(15,4)
  2038. , minimumbaltoapplyfc numeric(15,4)
  2039. , minimumfinancechrg numeric(15,4)
  2040. , agingcatbalexceeds numeric(15,4)
  2041. , numberofdaystorecalc numeric(15,4)
  2042. , daysbeforecrdtcardexp numeric(15,4)
  2043. , yearstoretaincashrcptshist numeric(15,4)
  2044. , yearstoretaincustomerhist numeric(15,4)
  2045. , yearstoretainslspsnhist numeric(15,4)
  2046. , dateupdated date
  2047. , timeupdated varchar(8)
  2048. , userupdatedkey varchar(10)
  2049. , searchforinvbylotserialno varchar(1)
  2050. , applychangestorepetitiveinv varchar(1)
  2051. , billtocustomerrpting varchar(1)
  2052. , postbybilltodivtogl varchar(1)
  2053. , printsoldtocustnoonstmt varchar(1)
  2054. , tracksaleshistoryby varchar(1)
  2055. , defaultcreditholdsetting varchar(1)
  2056. , defaultcreditlimitsetting varchar(1)
  2057. , defaultbilltoaddrsetting varchar(1)
  2058. , defaultcustpricingsetting varchar(1)
  2059. , defaulttermscodesetting varchar(1)
  2060. , CONSTRAINT rar_options_KEY0_pk PRIMARY KEY (modulecode)
  2061. , CONSTRAINT rar_options_KEY0_check CHECK (modulecode IS NOT NULL)
  2062. ) WITH (OIDS=FALSE);
  2063.  
  2064.  
  2065. CREATE TABLE sageimport.rar_paymenttype(
  2066. paymenttype varchar(5)
  2067. , paymentdesc varchar(30)
  2068. , paymentmethod varchar(1)
  2069. , assetacctkey varchar(9)
  2070. , creditcardaccrualacctkey varchar(9)
  2071. , defaulttransaction varchar(1)
  2072. , ebminternetenabled varchar(1)
  2073. , creditcardsetuptested varchar(1)
  2074. , merchantid varchar(32)
  2075. , allowcorporatecards varchar(1)
  2076. , merchantkey varchar(13)
  2077. , discountpercentage numeric(15,4)
  2078. , pertransactionfee numeric(15,4)
  2079. , preauthorizationterm numeric(15,4)
  2080. , datecreated date
  2081. , timecreated varchar(8)
  2082. , usercreatedkey varchar(10)
  2083. , dateupdated date
  2084. , timeupdated varchar(8)
  2085. , userupdatedkey varchar(10)
  2086. , displayavscvvresponse varchar(1)
  2087. , addcorporatecardlevel3 varchar(1)
  2088. , virtualterminalid varchar(13)
  2089. , CONSTRAINT rar_paymenttype_KEY0_pk PRIMARY KEY (paymenttype)
  2090. , CONSTRAINT rar_paymenttype_KEY0_check CHECK (paymenttype IS NOT NULL)
  2091. ) WITH (OIDS=FALSE);
  2092.  
  2093.  
  2094. CREATE TABLE sageimport.rar_salesperson(
  2095. salespersondivisionno varchar(2)
  2096. , salespersonno varchar(4)
  2097. , salespersonname varchar(30)
  2098. , addressline1 varchar(30)
  2099. , addressline2 varchar(30)
  2100. , addressline3 varchar(30)
  2101. , city varchar(20)
  2102. , state varchar(2)
  2103. , zipcode varchar(10)
  2104. , countrycode varchar(3)
  2105. , telephoneno varchar(17)
  2106. , telephoneext varchar(5)
  2107. , emailaddress varchar(50)
  2108. , salesmanagerdivisionno varchar(2)
  2109. , salesmanagerno varchar(4)
  2110. , crmuserid varchar(11)
  2111. , userkey varchar(10)
  2112. , commissionrate numeric(15,4)
  2113. , salesmanagercommrate numeric(15,4)
  2114. , datecreated date
  2115. , timecreated varchar(8)
  2116. , usercreatedkey varchar(10)
  2117. , dateupdated date
  2118. , timeupdated varchar(8)
  2119. , userupdatedkey varchar(10)
  2120. , CONSTRAINT rar_salesperson_KEY0_pk PRIMARY KEY (salespersondivisionno,salespersonno)
  2121. , CONSTRAINT rar_salesperson_KEY0_check CHECK (salespersondivisionno is not null and salespersonno IS NOT NULL)
  2122. ) WITH (OIDS=FALSE);
  2123. CREATE INDEX rar_salesperson_KEY1_index ON sageimport.rar_salesperson (crmuserid);
  2124. CREATE INDEX rar_salesperson_KEY2_index ON sageimport.rar_salesperson (userkey);
  2125.  
  2126.  
  2127. CREATE TABLE sageimport.rar_salespersoncommission(
  2128. salespersondivisionno varchar(2)
  2129. , salespersonno varchar(4)
  2130. , ardivisionno varchar(2)
  2131. , customerno varchar(20)
  2132. , invoiceno varchar(7)
  2133. , invoicetype varchar(2)
  2134. , invoicedate date
  2135. , paydate date
  2136. , applytono varchar(7)
  2137. , hascommrecordbeenedited varchar(1)
  2138. , linkupdated varchar(1)
  2139. , commissionrate numeric(15,4)
  2140. , invoicetotal numeric(15,4)
  2141. , salessubjecttocomm numeric(15,4)
  2142. , costsubjecttocomm numeric(15,4)
  2143. , commissionamt numeric(15,4)
  2144. , invoiceamountpaid numeric(15,4)
  2145. , splitcommpercent numeric(15,4)
  2146. , dateupdated date
  2147. , timeupdated varchar(8)
  2148. , userupdatedkey varchar(10)
  2149. , billtodivisionno varchar(2)
  2150. , billtocustomerno varchar(20)
  2151. , CONSTRAINT rar_salespersoncommission_KEY0_pk PRIMARY KEY (salespersondivisionno,salespersonno,ardivisionno,customerno,invoiceno,invoicetype)
  2152. , CONSTRAINT rar_salespersoncommission_KEY0_check CHECK (salespersondivisionno is not null and salespersonno is not null and ardivisionno is not null and customerno is not null and invoiceno is not null and invoicetype IS NOT NULL)
  2153. ) WITH (OIDS=FALSE);
  2154. CREATE INDEX rar_salespersoncommission_KEY1_index ON sageimport.rar_salespersoncommission (ardivisionno,customerno);
  2155. CREATE INDEX rar_salespersoncommission_KEY2_index ON sageimport.rar_salespersoncommission (billtodivisionno,billtocustomerno);
  2156.  
  2157.  
  2158. CREATE TABLE sageimport.rar_salespersonhistory(
  2159. salespersondivisionno varchar(2)
  2160. , salespersonno varchar(4)
  2161. , fiscalyear varchar(4)
  2162. , fiscalperiod varchar(2)
  2163. , commissiondollarssold numeric(15,4)
  2164. , grossprofitamt numeric(15,4)
  2165. , commissionamt numeric(15,4)
  2166. , dateupdated date
  2167. , timeupdated varchar(8)
  2168. , userupdatedkey varchar(10)
  2169. , CONSTRAINT rar_salespersonhistory_KEY0_pk PRIMARY KEY (salespersondivisionno,salespersonno,fiscalyear,fiscalperiod)
  2170. , CONSTRAINT rar_salespersonhistory_KEY0_check CHECK (salespersondivisionno is not null and salespersonno is not null and fiscalyear is not null and fiscalperiod IS NOT NULL)
  2171. ) WITH (OIDS=FALSE);
  2172. CREATE INDEX rar_salespersonhistory_KEY1_index ON sageimport.rar_salespersonhistory (fiscalyear,fiscalperiod,salespersondivisionno,salespersonno);
  2173. CREATE INDEX rar_salespersonhistory_KEY2_index ON sageimport.rar_salespersonhistory (fiscalyear,fiscalperiod,salespersondivisionno,salespersonno);
  2174.  
  2175.  
  2176. CREATE TABLE sageimport.rar_salestax(
  2177. taxcode varchar(15)
  2178. , transactiondate date
  2179. , invoiceno varchar(7)
  2180. , invoicetype varchar(2)
  2181. , ardivisionno varchar(2)
  2182. , customerno varchar(20)
  2183. , customername varchar(30)
  2184. , modulecode varchar(3)
  2185. , sourcejournalno varchar(6)
  2186. , primarytaxcode varchar(15)
  2187. , exemptionno varchar(20)
  2188. , override varchar(1)
  2189. , taxablesalesamt numeric(15,4)
  2190. , nontaxablesalesamt numeric(15,4)
  2191. , taxablefreightamt numeric(15,4)
  2192. , nontaxablefreightamt numeric(15,4)
  2193. , salestaxinvoiced numeric(15,4)
  2194. , salestaxcollected numeric(15,4)
  2195. , taxabletaxamt numeric(15,4)
  2196. , exemptsalesamt numeric(15,4)
  2197. , dateupdated date
  2198. , timeupdated varchar(8)
  2199. , userupdatedkey varchar(10)
  2200. , CONSTRAINT rar_salestax_KEY0_pk PRIMARY KEY (taxcode,transactiondate,invoiceno,invoicetype)
  2201. , CONSTRAINT rar_salestax_KEY0_check CHECK (taxcode is not null and transactiondate is not null and invoiceno is not null and invoicetype IS NOT NULL)
  2202. ) WITH (OIDS=FALSE);
  2203. CREATE INDEX rar_salestax_KEY1_index ON sageimport.rar_salestax (primarytaxcode,taxcode,transactiondate,invoiceno,invoicetype);
  2204. CREATE INDEX rar_salestax_KEY2_index ON sageimport.rar_salestax (taxcode,invoiceno,invoicetype);
  2205. CREATE INDEX rar_salestax_KEY3_index ON sageimport.rar_salestax (primarytaxcode,taxcode,invoiceno,invoicetype);
  2206. CREATE INDEX rar_salestax_KEY4_index ON sageimport.rar_salestax (transactiondate,taxcode,invoiceno,invoicetype);
  2207.  
  2208.  
  2209. CREATE TABLE sageimport.rar_termscode(
  2210. termscode varchar(2)
  2211. , termscodedesc varchar(30)
  2212. , duedateadayofthemonth varchar(1)
  2213. , discountdateadayofthemo varchar(1)
  2214. , discountcalculationmethod varchar(1)
  2215. , daysbeforedue numeric(15,4)
  2216. , minimumdaysallowedinv numeric(15,4)
  2217. , daysbeforediscountdue numeric(15,4)
  2218. , minimumdaysalloweddisc numeric(15,4)
  2219. , discountrate numeric(15,4)
  2220. , datecreated date
  2221. , timecreated varchar(8)
  2222. , usercreatedkey varchar(10)
  2223. , dateupdated date
  2224. , timeupdated varchar(8)
  2225. , userupdatedkey varchar(10)
  2226. , CONSTRAINT rar_termscode_KEY0_pk PRIMARY KEY (termscode)
  2227. , CONSTRAINT rar_termscode_KEY0_check CHECK (termscode IS NOT NULL)
  2228. ) WITH (OIDS=FALSE);
  2229.  
  2230.  
  2231. CREATE TABLE sageimport.rar_transactionpaymenthistory(
  2232. ardivisionno varchar(2)
  2233. , customerno varchar(20)
  2234. , invoiceno varchar(7)
  2235. , invoicetype varchar(2)
  2236. , invoicehistoryheaderseqno varchar(6)
  2237. , transactiondate date
  2238. , sequenceno varchar(6)
  2239. , paymentreference varchar(14)
  2240. , checkno varchar(10)
  2241. , transactiontype varchar(1)
  2242. , paymentdate date
  2243. , paymenttype varchar(5)
  2244. , otherpaymenttyperefno varchar(24)
  2245. , cardholdername varchar(30)
  2246. , expirationdateyear varchar(4)
  2247. , expirationdatemonth varchar(2)
  2248. , creditcardauthorizationno varchar(16)
  2249. , last4unencryptedcreditcardnos varchar(4)
  2250. , creditcardtransactionid varchar(10)
  2251. , rmano varchar(7)
  2252. , transactionamt numeric(15,4)
  2253. , dateupdated date
  2254. , timeupdated varchar(8)
  2255. , userupdatedkey varchar(10)
  2256. , creditcardid varchar(10)
  2257. , cardtype varchar(1)
  2258. , bankaccounttype varchar(1)
  2259. , bankname varchar(30)
  2260. , creditcardentryno varchar(6)
  2261. , last4bankroutingnos varchar(4)
  2262. , last4bankaccountnos varchar(4)
  2263. , CONSTRAINT rar_transactionpaymenthistory_KEY0_pk PRIMARY KEY (ardivisionno,customerno,invoiceno,invoicetype,transactiondate,sequenceno)
  2264. , CONSTRAINT rar_transactionpaymenthistory_KEY0_check CHECK (ardivisionno is not null and customerno is not null and invoiceno is not null and invoicetype is not null and transactiondate is not null and sequenceno IS NOT NULL)
  2265. ) WITH (OIDS=FALSE);
  2266. CREATE INDEX rar_transactionpaymenthistory_KEY1_index ON sageimport.rar_transactionpaymenthistory (ardivisionno,customerno,invoiceno,transactiontype,creditcardentryno);
  2267. CREATE INDEX rar_transactionpaymenthistory_KEY2_index ON sageimport.rar_transactionpaymenthistory (ardivisionno,customerno,transactiondate,invoiceno,invoicetype,sequenceno);
  2268. CREATE INDEX rar_transactionpaymenthistory_KEY3_index ON sageimport.rar_transactionpaymenthistory (ardivisionno,customerno,transactiondate,invoiceno,invoicetype,sequenceno);
  2269. CREATE INDEX rar_transactionpaymenthistory_KEY4_index ON sageimport.rar_transactionpaymenthistory (expirationdateyear,expirationdatemonth,ardivisionno,customerno,invoiceno,invoicetype,transactiondate,sequenceno);
  2270. CREATE INDEX rar_transactionpaymenthistory_KEY5_index ON sageimport.rar_transactionpaymenthistory (transactiondate,ardivisionno,customerno,invoiceno,invoicetype,sequenceno);
  2271.  
  2272.  
  2273. CREATE TABLE sageimport.rbm_billdetail(
  2274. billno varchar(30)
  2275. , revision varchar(3)
  2276. , linekey varchar(6)
  2277. , lineseqno varchar(14)
  2278. , componentitemcode varchar(30)
  2279. , componentrevision varchar(3)
  2280. , itemtype varchar(1)
  2281. , componentdesc varchar(30)
  2282. , engineeringdrawingfindno varchar(5)
  2283. , engineeringchangeaddno varchar(7)
  2284. , engineeringchangeadddate date
  2285. , engineeringchangedelno varchar(7)
  2286. , engineeringchangedeldate date
  2287. , workorderstepno varchar(4)
  2288. , billtype varchar(1)
  2289. , commenttext text
  2290. , miscchargeglacctkey varchar(9)
  2291. , setupcharge varchar(1)
  2292. , unitofmeasure varchar(4)
  2293. , quantityperbill numeric(15,4)
  2294. , standardunitcost numeric(15,4)
  2295. , scrappercent numeric(15,4)
  2296. , CONSTRAINT rbm_billdetail_KEY0_pk PRIMARY KEY (billno,revision,linekey)
  2297. , CONSTRAINT rbm_billdetail_KEY0_check CHECK (billno is not null and revision is not null and linekey IS NOT NULL)
  2298. ) WITH (OIDS=FALSE);
  2299. CREATE INDEX rbm_billdetail_KEY1_index ON sageimport.rbm_billdetail (billno,revision,lineseqno,linekey);
  2300. CREATE INDEX rbm_billdetail_KEY2_index ON sageimport.rbm_billdetail (componentitemcode,billno,revision,componentrevision,linekey);
  2301.  
  2302.  
  2303. CREATE TABLE sageimport.rbm_billheader(
  2304. billno varchar(30)
  2305. , revision varchar(3)
  2306. , billdesc1 varchar(30)
  2307. , billdesc2 varchar(30)
  2308. , billtype varchar(1)
  2309. , drawingno varchar(20)
  2310. , drawingrevision varchar(3)
  2311. , datelastused date
  2312. , routingno varchar(20)
  2313. , billhasoptions varchar(1)
  2314. , currentbillrevision varchar(3)
  2315. , optioninteractions varchar(1)
  2316. , optioncategories varchar(1)
  2317. , printcomponentdetail varchar(1)
  2318. , maximumlotsize numeric(15,4)
  2319. , yieldpercent numeric(15,4)
  2320. , datecreated date
  2321. , timecreated varchar(8)
  2322. , usercreatedkey varchar(10)
  2323. , dateupdated date
  2324. , timeupdated varchar(8)
  2325. , userupdatedkey varchar(10)
  2326. , CONSTRAINT rbm_billheader_KEY0_pk PRIMARY KEY (billno,revision)
  2327. , CONSTRAINT rbm_billheader_KEY0_check CHECK (billno is not null and revision IS NOT NULL)
  2328. ) WITH (OIDS=FALSE);
  2329. CREATE INDEX rbm_billheader_KEY1_index ON sageimport.rbm_billheader (billtype,billno,revision);
  2330.  
  2331.  
  2332. CREATE TABLE sageimport.rbm_billoptioncategory(
  2333. billno varchar(30)
  2334. , revision varchar(3)
  2335. , billoptioncategory1desc varchar(30)
  2336. , billoptioncategory2desc varchar(30)
  2337. , billoptioncategory3desc varchar(30)
  2338. , billoptioncategory4desc varchar(30)
  2339. , billoptioncategory5desc varchar(30)
  2340. , billoptioncategory6desc varchar(30)
  2341. , billoptioncategory7desc varchar(30)
  2342. , billoptioncategory8desc varchar(30)
  2343. , billoptioncategory9desc varchar(30)
  2344. , billoption1required varchar(1)
  2345. , billoption2required varchar(1)
  2346. , billoption3required varchar(1)
  2347. , billoption4required varchar(1)
  2348. , billoption5required varchar(1)
  2349. , billoption6required varchar(1)
  2350. , billoption7required varchar(1)
  2351. , billoption8required varchar(1)
  2352. , billoption9required varchar(1)
  2353. , userupdatedkey varchar(10)
  2354. , dateupdated date
  2355. , timeupdated varchar(8)
  2356. , CONSTRAINT rbm_billoptioncategory_KEY0_pk PRIMARY KEY (billno,revision)
  2357. , CONSTRAINT rbm_billoptioncategory_KEY0_check CHECK (billno is not null and revision IS NOT NULL)
  2358. ) WITH (OIDS=FALSE);
  2359.  
  2360.  
  2361. CREATE TABLE sageimport.rbm_billwhereused(
  2362. componentitemcode varchar(30)
  2363. , phantombill varchar(1)
  2364. , CONSTRAINT rbm_billwhereused_KEY0_pk PRIMARY KEY (componentitemcode)
  2365. , CONSTRAINT rbm_billwhereused_KEY0_check CHECK (componentitemcode IS NOT NULL)
  2366. ) WITH (OIDS=FALSE);
  2367.  
  2368.  
  2369. CREATE TABLE sageimport.rbm_options(
  2370. modulecode varchar(3)
  2371. , newsystem varchar(1)
  2372. , requirebillrevisions varchar(1)
  2373. , useoptionbills varchar(1)
  2374. , enableengineeringchangecontrol varchar(1)
  2375. , productionentryregindetail varchar(1)
  2376. , postmiscchargestoglbywhse varchar(1)
  2377. , allowkitbills varchar(1)
  2378. , allowphantombills varchar(1)
  2379. , allowduplicatecomponents varchar(1)
  2380. , allowentryofnegativeqty varchar(1)
  2381. , allowscrapyieldpercentfactors varchar(1)
  2382. , maximumnumberoflevels numeric(15,4)
  2383. , integrategeneralledger varchar(1)
  2384. , explodesubassemblies varchar(1)
  2385. , integerunitsofmeasure01 varchar(4)
  2386. , integerunitsofmeasure02 varchar(4)
  2387. , integerunitsofmeasure03 varchar(4)
  2388. , integerunitsofmeasure04 varchar(4)
  2389. , integerunitsofmeasure05 varchar(4)
  2390. , integerunitsofmeasure06 varchar(4)
  2391. , integerunitsofmeasure07 varchar(4)
  2392. , integerunitsofmeasure08 varchar(4)
  2393. , integerunitsofmeasure09 varchar(4)
  2394. , integerunitsofmeasure10 varchar(4)
  2395. , nextproductionno varchar(7)
  2396. , nextdisassemblyno varchar(7)
  2397. , nextengineeringchangeno varchar(7)
  2398. , nextreplacedeleterefno varchar(7)
  2399. , printproductionlabels varchar(1)
  2400. , printpickingsheetsby varchar(1)
  2401. , printeachproddisassemonseppage varchar(1)
  2402. , retainproductionhistory varchar(1)
  2403. , retaindtlhistforissuetran varchar(1)
  2404. , companycode varchar(3)
  2405. , dataversion numeric(15,4)
  2406. , dateupdated date
  2407. , timeupdated varchar(8)
  2408. , userupdatedkey varchar(10)
  2409. , syncbillitemdescription varchar(1)
  2410. , datasublevel numeric(15,4)
  2411. , CONSTRAINT rbm_options_KEY0_pk PRIMARY KEY (modulecode)
  2412. , CONSTRAINT rbm_options_KEY0_check CHECK (modulecode IS NOT NULL)
  2413. ) WITH (OIDS=FALSE);
  2414.  
  2415.  
  2416. CREATE TABLE sageimport.rbm_productionhistorydetail(
  2417. productionno varchar(7)
  2418. , productionseqno varchar(6)
  2419. , linekey varchar(6)
  2420. , lineseqno varchar(14)
  2421. , itemtype varchar(1)
  2422. , componentitemcode varchar(30)
  2423. , componentrevision varchar(3)
  2424. , componentdesc varchar(30)
  2425. , componentwarehousecode varchar(3)
  2426. , commenttext text
  2427. , glaccountkey varchar(9)
  2428. , valuation varchar(1)
  2429. , itemcode varchar(30)
  2430. , itemdesc varchar(30)
  2431. , unitofmeasure varchar(4)
  2432. , quantityperbill numeric(15,4)
  2433. , extendedquantity numeric(15,4)
  2434. , totalcost numeric(15,4)
  2435. , CONSTRAINT rbm_productionhistorydetail_KEY0_pk PRIMARY KEY (productionno,productionseqno,linekey)
  2436. , CONSTRAINT rbm_productionhistorydetail_KEY0_check CHECK (productionno is not null and productionseqno is not null and linekey IS NOT NULL)
  2437. ) WITH (OIDS=FALSE);
  2438. CREATE INDEX rbm_productionhistorydetail_KEY1_index ON sageimport.rbm_productionhistorydetail (productionno,productionseqno,lineseqno,linekey);
  2439.  
  2440.  
  2441. CREATE TABLE sageimport.rbm_productionhistoryheader(
  2442. productionno varchar(7)
  2443. , productionseqno varchar(6)
  2444. , productiondate date
  2445. , billno varchar(30)
  2446. , revision varchar(3)
  2447. , billoption1 varchar(2)
  2448. , billoption2 varchar(2)
  2449. , billoption3 varchar(2)
  2450. , billoption4 varchar(2)
  2451. , billoption5 varchar(2)
  2452. , billoption6 varchar(2)
  2453. , billoption7 varchar(2)
  2454. , billoption8 varchar(2)
  2455. , billoption9 varchar(2)
  2456. , effectivedate date
  2457. , parentwarehousecode varchar(3)
  2458. , lotnoorstartingserialno varchar(15)
  2459. , disassembly varchar(1)
  2460. , disassemblytype varchar(1)
  2461. , productiondisassemblysrcjrnl varchar(2)
  2462. , productiondisassemblyregno varchar(6)
  2463. , productionquantity numeric(15,4)
  2464. , billcalcunitcost numeric(15,4)
  2465. , totalimcost numeric(15,4)
  2466. , datecreated date
  2467. , timecreated varchar(8)
  2468. , usercreatedkey varchar(10)
  2469. , dateupdated date
  2470. , timeupdated varchar(8)
  2471. , userupdatedkey varchar(10)
  2472. , CONSTRAINT rbm_productionhistoryheader_KEY0_pk PRIMARY KEY (productionno,productionseqno)
  2473. , CONSTRAINT rbm_productionhistoryheader_KEY0_check CHECK (productionno is not null and productionseqno IS NOT NULL)
  2474. ) WITH (OIDS=FALSE);
  2475.  
  2476.  
  2477. CREATE TABLE sageimport.rci_conversionhistory(
  2478. version varchar(11)
  2479. , conversiontype varchar(30)
  2480. , tablename varchar(50)
  2481. , conversionid varchar(6)
  2482. , developercode varchar(3)
  2483. , conversionnotes text
  2484. , ignorerecord varchar(1)
  2485. , datecreated date
  2486. , timecreated varchar(8)
  2487. , usercreatedkey varchar(10)
  2488. , CONSTRAINT rci_conversionhistory_KEY0_pk PRIMARY KEY (version,conversiontype,tablename,conversionid,developercode)
  2489. , CONSTRAINT rci_conversionhistory_KEY0_check CHECK (version is not null and conversiontype is not null and tablename is not null and conversionid is not null and developercode IS NOT NULL)
  2490. ) WITH (OIDS=FALSE);
  2491.  
  2492.  
  2493. CREATE TABLE sageimport.rci_enhancementactivation(
  2494. modulecode varchar(3)
  2495. , developercode varchar(3)
  2496. , enhancementcode varchar(10)
  2497. , datalevel numeric(15,4)
  2498. , sublevel numeric(15,4)
  2499. , CONSTRAINT rci_enhancementactivation_KEY0_pk PRIMARY KEY (modulecode,developercode,enhancementcode)
  2500. , CONSTRAINT rci_enhancementactivation_KEY0_check CHECK (modulecode is not null and developercode is not null and enhancementcode IS NOT NULL)
  2501. ) WITH (OIDS=FALSE);
  2502.  
  2503.  
  2504. CREATE TABLE sageimport.rci_extendeddescription(
  2505. extendeddescriptionkey varchar(10)
  2506. , extendeddescriptiontext text
  2507. , creationmodulecode varchar(3)
  2508. , updatedmodulecode varchar(3)
  2509. , datecreated date
  2510. , timecreated varchar(8)
  2511. , usercreatedkey varchar(10)
  2512. , dateupdated date
  2513. , timeupdated varchar(8)
  2514. , userupdatedkey varchar(10)
  2515. , CONSTRAINT rci_extendeddescription_KEY0_pk PRIMARY KEY (extendeddescriptionkey)
  2516. , CONSTRAINT rci_extendeddescription_KEY0_check CHECK (extendeddescriptionkey IS NOT NULL)
  2517. ) WITH (OIDS=FALSE);
  2518.  
  2519.  
  2520. CREATE TABLE sageimport.rci_inactivereasoncode(
  2521. inactivereasoncode varchar(5)
  2522. , inactivereasoncodedesc varchar(30)
  2523. , datecreated date
  2524. , timecreated varchar(8)
  2525. , usercreatedkey varchar(10)
  2526. , dateupdated date
  2527. , timeupdated varchar(8)
  2528. , userupdatedkey varchar(10)
  2529. , CONSTRAINT rci_inactivereasoncode_KEY0_pk PRIMARY KEY (inactivereasoncode)
  2530. , CONSTRAINT rci_inactivereasoncode_KEY0_check CHECK (inactivereasoncode IS NOT NULL)
  2531. ) WITH (OIDS=FALSE);
  2532.  
  2533.  
  2534. CREATE TABLE sageimport.rci_item(
  2535. itemcode varchar(30)
  2536. , itemtype varchar(1)
  2537. , itemcodedesc varchar(30)
  2538. , extendeddescriptionkey varchar(10)
  2539. , useinar varchar(1)
  2540. , useinso varchar(1)
  2541. , useinpo varchar(1)
  2542. , useinbm varchar(1)
  2543. , calculatecommission varchar(1)
  2544. , dropship varchar(1)
  2545. , ebmenabled varchar(1)
  2546. , allowbackorders varchar(1)
  2547. , allowreturns varchar(1)
  2548. , pricecode varchar(4)
  2549. , allowtradediscount varchar(1)
  2550. , printreceiptlabels varchar(1)
  2551. , allocatelandedcost varchar(1)
  2552. , confirmcostincrinrcptofgoods varchar(1)
  2553. , warrantycode varchar(10)
  2554. , salesunitofmeasure varchar(4)
  2555. , purchaseunitofmeasure varchar(4)
  2556. , standardunitofmeasure varchar(4)
  2557. , posttoglbydivision varchar(1)
  2558. , salesacctkey varchar(9)
  2559. , costofgoodssoldacctkey varchar(9)
  2560. , inventoryacctkey varchar(9)
  2561. , purchaseacctkey varchar(9)
  2562. , manufacturingcostacctkey varchar(9)
  2563. , taxclass varchar(2)
  2564. , purchasestaxclass varchar(2)
  2565. , productline varchar(4)
  2566. , producttype varchar(1)
  2567. , valuation varchar(1)
  2568. , defaultwarehousecode varchar(3)
  2569. , primaryapdivisionno varchar(2)
  2570. , primaryvendorno varchar(7)
  2571. , imagefile varchar(30)
  2572. , lastsolddate date
  2573. , lastreceiptdate date
  2574. , category1 varchar(10)
  2575. , category2 varchar(10)
  2576. , category3 varchar(10)
  2577. , category4 varchar(10)
  2578. , salespromotioncode varchar(10)
  2579. , salestartingdate date
  2580. , saleendingdate date
  2581. , salemethod varchar(1)
  2582. , explodekititems varchar(1)
  2583. , shipweight varchar(10)
  2584. , commenttext text
  2585. , restockingmethod varchar(1)
  2586. , nextlotserialno varchar(15)
  2587. , inventorycycle varchar(1)
  2588. , routingno varchar(20)
  2589. , procurementtype varchar(1)
  2590. , plannercode varchar(3)
  2591. , buyercode varchar(3)
  2592. , lowlevelcode varchar(2)
  2593. , plannedbymrp varchar(1)
  2594. , vendoritemcode varchar(30)
  2595. , setupcharge varchar(1)
  2596. , attachmentfilename varchar(30)
  2597. , itemimagewidthinpixels numeric(15,4)
  2598. , itemimageheightinpixels numeric(15,4)
  2599. , standardunitcost numeric(15,4)
  2600. , standardunitprice numeric(15,4)
  2601. , lasttotalunitcost numeric(15,4)
  2602. , averageunitcost numeric(15,4)
  2603. , salespromotionprice numeric(15,4)
  2604. , suggestedretailprice numeric(15,4)
  2605. , salespromotiondiscountpercent numeric(15,4)
  2606. , totalquantityonhand numeric(15,4)
  2607. , averagebackorderfilldays numeric(15,4)
  2608. , lastallocatedunitcost numeric(15,4)
  2609. , commissionrate numeric(15,4)
  2610. , basecommamt numeric(15,4)
  2611. , purchaseumconvfctr numeric(15,4)
  2612. , salesumconvfctr numeric(15,4)
  2613. , volume numeric(15,4)
  2614. , restockingcharge numeric(15,4)
  2615. , totalinventoryvalue numeric(15,4)
  2616. , datecreated date
  2617. , timecreated varchar(8)
  2618. , usercreatedkey varchar(10)
  2619. , dateupdated date
  2620. , timeupdated varchar(8)
  2621. , userupdatedkey varchar(10)
  2622. , udf_purchase_desc varchar(254)
  2623. , inactiveitem varchar(1)
  2624. , lastphysicalcountdate date
  2625. , commoditycode varchar(12)
  2626. , CONSTRAINT rci_item_KEY0_pk PRIMARY KEY (itemcode)
  2627. , CONSTRAINT rci_item_KEY0_check CHECK (itemcode IS NOT NULL)
  2628. ) WITH (OIDS=FALSE);
  2629. CREATE INDEX rci_item_KEY1_index ON sageimport.rci_item (itemtype,itemcode);
  2630. CREATE INDEX rci_item_KEY2_index ON sageimport.rci_item (extendeddescriptionkey,itemcode);
  2631. CREATE INDEX rci_item_KEY3_index ON sageimport.rci_item (productline,itemcode);
  2632. CREATE INDEX rci_item_KEY4_index ON sageimport.rci_item (salespromotioncode,itemcode);
  2633. CREATE INDEX rci_item_KEY5_index ON sageimport.rci_item (itemcodedesc,itemcode,itemtype);
  2634.  
  2635.  
  2636. CREATE TABLE sageimport.rci_options(
  2637. modulecode varchar(3)
  2638. , newsystem varchar(1)
  2639. , companycode varchar(3)
  2640. , allowexpandeditemcodes varchar(1)
  2641. , numberofdecimalplacesinprice numeric(15,4)
  2642. , numberofdecimalplacesinqty numeric(15,4)
  2643. , numberofdecimalplacesincost numeric(15,4)
  2644. , numberofdecimalplacesinum numeric(15,4)
  2645. , yearstoretainitemhistory numeric(15,4)
  2646. , dataversion numeric(15,4)
  2647. , dateupdated date
  2648. , timeupdated varchar(8)
  2649. , userupdatedkey varchar(10)
  2650. , companyversion varchar(11)
  2651. , datasublevel numeric(15,4)
  2652. , CONSTRAINT rci_options_KEY0_pk PRIMARY KEY (modulecode)
  2653. , CONSTRAINT rci_options_KEY0_check CHECK (modulecode IS NOT NULL)
  2654. ) WITH (OIDS=FALSE);
  2655.  
  2656.  
  2657. CREATE TABLE sageimport.rci_unitofmeasure(
  2658. unitofmeasure varchar(4)
  2659. , conversionum1 varchar(4)
  2660. , conversionfactor1 numeric(15,4)
  2661. , conversionum2 varchar(4)
  2662. , conversionfactor2 numeric(15,4)
  2663. , conversionum3 varchar(4)
  2664. , conversionfactor3 numeric(15,4)
  2665. , conversionum4 varchar(4)
  2666. , conversionfactor4 numeric(15,4)
  2667. , conversionum5 varchar(4)
  2668. , conversionfactor5 numeric(15,4)
  2669. , datecreated date
  2670. , timecreated varchar(8)
  2671. , usercreatedkey varchar(10)
  2672. , dateupdated date
  2673. , timeupdated varchar(8)
  2674. , userupdatedkey varchar(10)
  2675. , CONSTRAINT rci_unitofmeasure_KEY0_pk PRIMARY KEY (unitofmeasure)
  2676. , CONSTRAINT rci_unitofmeasure_KEY0_check CHECK (unitofmeasure IS NOT NULL)
  2677. ) WITH (OIDS=FALSE);
  2678.  
  2679.  
  2680. CREATE TABLE sageimport.rcm_entity(
  2681. entity varchar(30)
  2682. , recordflag varchar(1)
  2683. , library varchar(30)
  2684. , description varchar(32)
  2685. , datafile varchar(16)
  2686. , linkedentities varchar(18)
  2687. , attribute varchar(1)
  2688. , segmentname varchar(64)
  2689. , segmenttype varchar(1)
  2690. , mirrortable varchar(30)
  2691. , keysize numeric(15,4)
  2692. , segmentsize numeric(15,4)
  2693. , segmentdesc varchar(80)
  2694. , CONSTRAINT rcm_entity_KEY0_pk PRIMARY KEY (entity,recordflag,library)
  2695. , CONSTRAINT rcm_entity_KEY0_check CHECK (entity is not null and recordflag is not null and library IS NOT NULL)
  2696. ) WITH (OIDS=FALSE);
  2697. CREATE INDEX rcm_entity_KEY1_index ON sageimport.rcm_entity (library,entity,recordflag);
  2698.  
  2699.  
  2700. CREATE TABLE sageimport.rcm_log(
  2701. sequenceno varchar(7)
  2702. , library varchar(64)
  2703. , libraryform varchar(32)
  2704. , userlogon varchar(60)
  2705. , companycode varchar(3)
  2706. , librarypath text
  2707. , CONSTRAINT rcm_log_KEY0_pk PRIMARY KEY (sequenceno)
  2708. , CONSTRAINT rcm_log_KEY0_check CHECK (sequenceno IS NOT NULL)
  2709. ) WITH (OIDS=FALSE);
  2710. CREATE INDEX rcm_log_KEY1_index ON sageimport.rcm_log (userlogon,library,libraryform,companycode);
  2711. CREATE INDEX rcm_log_KEY2_index ON sageimport.rcm_log (companycode,library,libraryform,userlogon);
  2712. CREATE INDEX rcm_log_KEY3_index ON sageimport.rcm_log (library,libraryform,userlogon,companycode);
  2713.  
  2714.  
  2715. CREATE TABLE sageimport.rcm_options(
  2716. keyval varchar(64)
  2717. , rcdval text
  2718. , CONSTRAINT rcm_options_KEY0_pk PRIMARY KEY (keyval)
  2719. , CONSTRAINT rcm_options_KEY0_check CHECK (keyval IS NOT NULL)
  2720. ) WITH (OIDS=FALSE);
  2721.  
  2722.  
  2723. CREATE TABLE sageimport.rcm_script(
  2724. scriptid varchar(32)
  2725. , scriptdesc varchar(40)
  2726. , languagetype varchar(1)
  2727. , priority varchar(3)
  2728. , filepath varchar(128)
  2729. , CONSTRAINT rcm_script_KEY0_pk PRIMARY KEY (scriptid)
  2730. , CONSTRAINT rcm_script_KEY0_check CHECK (scriptid IS NOT NULL)
  2731. ) WITH (OIDS=FALSE);
  2732.  
  2733.  
  2734. CREATE TABLE sageimport.rcm_udf(
  2735. entity varchar(30)
  2736. , fieldname varchar(30)
  2737. , recordflag varchar(1)
  2738. , sequence varchar(3)
  2739. , description varchar(40)
  2740. , controltype varchar(1)
  2741. , datatype varchar(1)
  2742. , dataclass varchar(30)
  2743. , datasourcebusobj varchar(128)
  2744. , datasourcetable varchar(128)
  2745. , datasourcecolumn varchar(128)
  2746. , maskflag varchar(1)
  2747. , maskvalue varchar(32)
  2748. , defaultflag varchar(1)
  2749. , defaultvalue varchar(64)
  2750. , captionflag varchar(1)
  2751. , captionvalue varchar(32)
  2752. , validationtype varchar(1)
  2753. , validationvalue text
  2754. , validationprogram varchar(128)
  2755. , displayattributes varchar(16)
  2756. , maxlength numeric(15,4)
  2757. , CONSTRAINT rcm_udf_KEY0_pk PRIMARY KEY (entity,fieldname,recordflag,sequence)
  2758. , CONSTRAINT rcm_udf_KEY0_check CHECK (entity is not null and fieldname is not null and recordflag is not null and sequence IS NOT NULL)
  2759. ) WITH (OIDS=FALSE);
  2760.  
  2761.  
  2762. CREATE TABLE sageimport.rcm_udfiolist(
  2763. entity varchar(3)
  2764. , linkedentity varchar(3)
  2765. , recordflag varchar(1)
  2766. , iolist text
  2767. , CONSTRAINT rcm_udfiolist_KEY0_pk PRIMARY KEY (entity,linkedentity,recordflag)
  2768. , CONSTRAINT rcm_udfiolist_KEY0_check CHECK (entity is not null and linkedentity is not null and recordflag IS NOT NULL)
  2769. ) WITH (OIDS=FALSE);
  2770.  
  2771.  
  2772. CREATE TABLE sageimport.rcm_uiscriptlink(
  2773. sequenceno varchar(7)
  2774. , libraryname varchar(50)
  2775. , panelname varchar(12)
  2776. , controlname varchar(30)
  2777. , eventcode varchar(20)
  2778. , languagetype varchar(1)
  2779. , procedurename varchar(96)
  2780. , crcvalue varchar(4)
  2781. , CONSTRAINT rcm_uiscriptlink_KEY0_pk PRIMARY KEY (sequenceno)
  2782. , CONSTRAINT rcm_uiscriptlink_KEY0_check CHECK (sequenceno IS NOT NULL)
  2783. ) WITH (OIDS=FALSE);
  2784. CREATE INDEX rcm_uiscriptlink_KEY1_index ON sageimport.rcm_uiscriptlink (libraryname,panelname,controlname,eventcode,languagetype);
  2785.  
  2786.  
  2787. CREATE TABLE sageimport.rcm_uiscriptsettings(
  2788. libraryname varchar(50)
  2789. , panelname varchar(12)
  2790. , controlname varchar(30)
  2791. , eventcode varchar(20)
  2792. , priority varchar(3)
  2793. , sequenceno varchar(2)
  2794. , scriptid varchar(32)
  2795. , CONSTRAINT rcm_uiscriptsettings_KEY0_pk PRIMARY KEY (libraryname,panelname,controlname,eventcode,priority,sequenceno)
  2796. , CONSTRAINT rcm_uiscriptsettings_KEY0_check CHECK (libraryname is not null and panelname is not null and controlname is not null and eventcode is not null and priority is not null and sequenceno IS NOT NULL)
  2797. ) WITH (OIDS=FALSE);
  2798.  
  2799.  
  2800. CREATE TABLE sageimport.res_options(
  2801. modulecode varchar(3)
  2802. , newsystem varchar(1)
  2803. , companylogofile varchar(128)
  2804. , promptuserforupdate varchar(1)
  2805. , performautomaticupdate varchar(1)
  2806. , lastgenerateddate date
  2807. , lastgeneratedtime varchar(8)
  2808. , lastgeneratedasofdate date
  2809. , pollingstartdate date
  2810. , pollingstarttime varchar(8)
  2811. , numberofpiesegments numeric(15,4)
  2812. , numberofdetaillines numeric(15,4)
  2813. , numberofhoursbetweenexecutions numeric(15,4)
  2814. , companyname varchar(50)
  2815. , dataversion numeric(15,4)
  2816. , dateupdated date
  2817. , timeupdated varchar(8)
  2818. , userupdatedkey varchar(10)
  2819. , CONSTRAINT res_options_KEY0_pk PRIMARY KEY (modulecode)
  2820. , CONSTRAINT res_options_KEY0_check CHECK (modulecode IS NOT NULL)
  2821. ) WITH (OIDS=FALSE);
  2822.  
  2823.  
  2824. CREATE TABLE sageimport.rgl_account(
  2825. accountkey varchar(9)
  2826. , accountdesc varchar(50)
  2827. , account varchar(41)
  2828. , rawaccount varchar(32)
  2829. , mainaccountcode varchar(15)
  2830. , datestart date
  2831. , dateend date
  2832. , status varchar(1)
  2833. , clearbalance varchar(1)
  2834. , accounttype varchar(2)
  2835. , cashflowstype varchar(1)
  2836. , rollupcode1 varchar(20)
  2837. , rollupcode2 varchar(20)
  2838. , rollupcode3 varchar(20)
  2839. , rollupcode4 varchar(20)
  2840. , accountgroup varchar(15)
  2841. , accountcategory varchar(1)
  2842. , companycode varchar(3)
  2843. , datecreated date
  2844. , timecreated varchar(8)
  2845. , usercreatedkey varchar(10)
  2846. , dateupdated date
  2847. , timeupdated varchar(8)
  2848. , userupdatedkey varchar(10)
  2849. , CONSTRAINT rgl_account_KEY0_pk PRIMARY KEY (accountkey)
  2850. , CONSTRAINT rgl_account_KEY0_check CHECK (accountkey IS NOT NULL)
  2851. , CONSTRAINT rgl_account_KEY1_unique UNIQUE (account)
  2852. ) WITH (OIDS=FALSE);
  2853. CREATE INDEX rgl_account_KEY2_index ON sageimport.rgl_account (rawaccount);
  2854. CREATE INDEX rgl_account_KEY3_index ON sageimport.rgl_account (accountgroup,account);
  2855. CREATE INDEX rgl_account_KEY4_index ON sageimport.rgl_account (mainaccountcode,account);
  2856. CREATE INDEX rgl_account_KEY5_index ON sageimport.rgl_account (rollupcode1,account);
  2857. CREATE INDEX rgl_account_KEY6_index ON sageimport.rgl_account (rollupcode2,account);
  2858. CREATE INDEX rgl_account_KEY7_index ON sageimport.rgl_account (rollupcode3,account);
  2859. CREATE INDEX rgl_account_KEY8_index ON sageimport.rgl_account (rollupcode4,account);
  2860. CREATE INDEX rgl_account_KEY9_index ON sageimport.rgl_account (status,account);
  2861.  
  2862.  
  2863. CREATE TABLE sageimport.rgl_accountcategory(
  2864. accountcategory varchar(1)
  2865. , accountcategorydesc varchar(40)
  2866. , CONSTRAINT rgl_accountcategory_KEY0_pk PRIMARY KEY (accountcategory)
  2867. , CONSTRAINT rgl_accountcategory_KEY0_check CHECK (accountcategory IS NOT NULL)
  2868. ) WITH (OIDS=FALSE);
  2869.  
  2870.  
  2871. CREATE TABLE sageimport.rgl_accountgroup(
  2872. accountgroup varchar(15)
  2873. , accountgroupdesc varchar(40)
  2874. , accountcategory varchar(1)
  2875. , accounttype varchar(2)
  2876. , cashflowstype varchar(1)
  2877. , CONSTRAINT rgl_accountgroup_KEY0_pk PRIMARY KEY (accountgroup)
  2878. , CONSTRAINT rgl_accountgroup_KEY0_check CHECK (accountgroup IS NOT NULL)
  2879. ) WITH (OIDS=FALSE);
  2880.  
  2881.  
  2882. CREATE TABLE sageimport.rgl_accounthistory(
  2883. accountkey varchar(9)
  2884. , accountdesc varchar(50)
  2885. , account varchar(41)
  2886. , rawaccount varchar(32)
  2887. , mainaccountcode varchar(15)
  2888. , datestart date
  2889. , dateend date
  2890. , status varchar(1)
  2891. , clearbalance varchar(1)
  2892. , accounttype varchar(2)
  2893. , cashflowstype varchar(1)
  2894. , rollupcode1 varchar(20)
  2895. , rollupcode2 varchar(20)
  2896. , rollupcode3 varchar(20)
  2897. , rollupcode4 varchar(20)
  2898. , accountgroup varchar(15)
  2899. , accountcategory varchar(1)
  2900. , companycode varchar(3)
  2901. , datecreated date
  2902. , timecreated varchar(8)
  2903. , usercreatedkey varchar(10)
  2904. , datedeleted date
  2905. , timedeleted varchar(8)
  2906. , userdeletedkey varchar(10)
  2907. , CONSTRAINT rgl_accounthistory_KEY0_pk PRIMARY KEY (accountkey)
  2908. , CONSTRAINT rgl_accounthistory_KEY0_check CHECK (accountkey IS NOT NULL)
  2909. ) WITH (OIDS=FALSE);
  2910. CREATE INDEX rgl_accounthistory_KEY1_index ON sageimport.rgl_accounthistory (account);
  2911. CREATE INDEX rgl_accounthistory_KEY2_index ON sageimport.rgl_accounthistory (rawaccount);
  2912. CREATE INDEX rgl_accounthistory_KEY3_index ON sageimport.rgl_accounthistory (accountgroup,account);
  2913. CREATE INDEX rgl_accounthistory_KEY4_index ON sageimport.rgl_accounthistory (mainaccountcode,account);
  2914. CREATE INDEX rgl_accounthistory_KEY5_index ON sageimport.rgl_accounthistory (rollupcode1,account);
  2915. CREATE INDEX rgl_accounthistory_KEY6_index ON sageimport.rgl_accounthistory (rollupcode2,account);
  2916. CREATE INDEX rgl_accounthistory_KEY7_index ON sageimport.rgl_accounthistory (rollupcode3,account);
  2917. CREATE INDEX rgl_accounthistory_KEY8_index ON sageimport.rgl_accounthistory (rollupcode4,account);
  2918.  
  2919.  
  2920. CREATE TABLE sageimport.rgl_accountsegment(
  2921. segmentno varchar(2)
  2922. , subaccountcode varchar(15)
  2923. , accountkey varchar(9)
  2924. , CONSTRAINT rgl_accountsegment_KEY0_pk PRIMARY KEY (segmentno,subaccountcode,accountkey)
  2925. , CONSTRAINT rgl_accountsegment_KEY0_check CHECK (segmentno is not null and subaccountcode is not null and accountkey IS NOT NULL)
  2926. ) WITH (OIDS=FALSE);
  2927. CREATE INDEX rgl_accountsegment_KEY1_index ON sageimport.rgl_accountsegment (accountkey,segmentno,subaccountcode);
  2928.  
  2929.  
  2930. CREATE TABLE sageimport.rgl_accountstructure(
  2931. segmentno varchar(2)
  2932. , segmentdesc varchar(15)
  2933. , segmentsize numeric(15,4)
  2934. , segmenttype varchar(1)
  2935. , CONSTRAINT rgl_accountstructure_KEY0_pk PRIMARY KEY (segmentno)
  2936. , CONSTRAINT rgl_accountstructure_KEY0_check CHECK (segmentno IS NOT NULL)
  2937. ) WITH (OIDS=FALSE);
  2938.  
  2939.  
  2940. CREATE TABLE sageimport.rgl_accounttype(
  2941. accounttype varchar(2)
  2942. , accounttypedesc varchar(40)
  2943. , accountcategory varchar(1)
  2944. , CONSTRAINT rgl_accounttype_KEY0_pk PRIMARY KEY (accounttype)
  2945. , CONSTRAINT rgl_accounttype_KEY0_check CHECK (accounttype IS NOT NULL)
  2946. ) WITH (OIDS=FALSE);
  2947.  
  2948.  
  2949. CREATE TABLE sageimport.rgl_audit(
  2950. userkey varchar(10)
  2951. , sequenceno varchar(14)
  2952. , workstationname varchar(30)
  2953. , date date
  2954. , accountkey varchar(9)
  2955. , transactiontype varchar(1)
  2956. , fieldname varchar(30)
  2957. , fieldvalueoriginal varchar(50)
  2958. , newfieldvalue varchar(50)
  2959. , CONSTRAINT rgl_audit_KEY0_pk PRIMARY KEY (userkey,date,sequenceno)
  2960. , CONSTRAINT rgl_audit_KEY0_check CHECK (userkey is not null and date is not null and sequenceno IS NOT NULL)
  2961. , CONSTRAINT rgl_audit_KEY2_unique UNIQUE (sequenceno)
  2962. ) WITH (OIDS=FALSE);
  2963. CREATE INDEX rgl_audit_KEY1_index ON sageimport.rgl_audit (accountkey);
  2964. CREATE INDEX rgl_audit_KEY3_index ON sageimport.rgl_audit (workstationname,userkey,date,sequenceno);
  2965.  
  2966.  
  2967. CREATE TABLE sageimport.rgl_bank(
  2968. bankcode varchar(1)
  2969. , bankdesc varchar(30)
  2970. , cashaccountkey varchar(9)
  2971. , bankaccountno varchar(17)
  2972. , nextcheckno varchar(6)
  2973. , checkprintingstatus varchar(1)
  2974. , currentbankbalance numeric(15,4)
  2975. , outstandingchecktotal numeric(15,4)
  2976. , numberoutstandingchecks numeric(15,4)
  2977. , outstandingdeposittotal numeric(15,4)
  2978. , nooutstandingdeposits numeric(15,4)
  2979. , outstandingadjusttotal numeric(15,4)
  2980. , numberoutstandingadjust numeric(15,4)
  2981. , statementbalance numeric(15,4)
  2982. , CONSTRAINT rgl_bank_KEY0_pk PRIMARY KEY (bankcode)
  2983. , CONSTRAINT rgl_bank_KEY0_check CHECK (bankcode IS NOT NULL)
  2984. ) WITH (OIDS=FALSE);
  2985.  
  2986.  
  2987. CREATE TABLE sageimport.rgl_budget(
  2988. budgetcode varchar(10)
  2989. , budgetdesc varchar(40)
  2990. , permanent varchar(1)
  2991. , CONSTRAINT rgl_budget_KEY0_pk PRIMARY KEY (budgetcode)
  2992. , CONSTRAINT rgl_budget_KEY0_check CHECK (budgetcode IS NOT NULL)
  2993. ) WITH (OIDS=FALSE);
  2994.  
  2995.  
  2996. CREATE TABLE sageimport.rgl_checkmicr(
  2997. bankcode varchar(1)
  2998. , checkprefix varchar(1)
  2999. , checksuffix varchar(1)
  3000. , routingno varchar(11)
  3001. , bankaccountno varchar(17)
  3002. , micrprintingenabled varchar(1)
  3003. , address1 varchar(30)
  3004. , address2 varchar(30)
  3005. , address3 varchar(30)
  3006. , city varchar(20)
  3007. , state varchar(2)
  3008. , zipcode varchar(10)
  3009. , countrycode varchar(3)
  3010. , contactcode varchar(30)
  3011. , telephone varchar(17)
  3012. , extension varchar(5)
  3013. , faxno varchar(17)
  3014. , emailaddress varchar(50)
  3015. , urladdress varchar(50)
  3016. , comment varchar(30)
  3017. , apdefaultformcode varchar(20)
  3018. , CONSTRAINT rgl_checkmicr_KEY0_pk PRIMARY KEY (bankcode)
  3019. , CONSTRAINT rgl_checkmicr_KEY0_check CHECK (bankcode IS NOT NULL)
  3020. ) WITH (OIDS=FALSE);
  3021.  
  3022.  
  3023. CREATE TABLE sageimport.rgl_companyactivebatch(
  3024. modulecode varchar(3)
  3025. , batchtype varchar(2)
  3026. , batchno varchar(5)
  3027. , batchsubtype varchar(1)
  3028. , privatebatch varchar(1)
  3029. , comment varchar(30)
  3030. , batchstatus varchar(1)
  3031. , batchgroup varchar(14)
  3032. , registerno varchar(6)
  3033. , datecreated date
  3034. , timecreated varchar(8)
  3035. , usercreatedkey varchar(10)
  3036. , dateupdated date
  3037. , timeupdated varchar(8)
  3038. , userupdatedkey varchar(10)
  3039. , recordcount numeric(15,4)
  3040. , batchtotal01 numeric(15,4)
  3041. , batchtotal02 numeric(15,4)
  3042. , batchtotal03 numeric(15,4)
  3043. , batchtotal04 numeric(15,4)
  3044. , batchtotal05 numeric(15,4)
  3045. , batchtotal06 numeric(15,4)
  3046. , batchtotal07 numeric(15,4)
  3047. , batchtotal08 numeric(15,4)
  3048. , batchtotal09 numeric(15,4)
  3049. , batchtotal10 numeric(15,4)
  3050. , CONSTRAINT rgl_companyactivebatch_KEY0_pk PRIMARY KEY (modulecode,batchtype,batchno)
  3051. , CONSTRAINT rgl_companyactivebatch_KEY0_check CHECK (modulecode is not null and batchtype is not null and batchno IS NOT NULL)
  3052. ) WITH (OIDS=FALSE);
  3053. CREATE INDEX rgl_companyactivebatch_KEY1_index ON sageimport.rgl_companyactivebatch (batchgroup,modulecode,batchtype,batchno);
  3054.  
  3055.  
  3056. CREATE TABLE sageimport.rgl_companybatchoptions(
  3057. modulecode varchar(3)
  3058. , batchtype varchar(2)
  3059. , enablebatchentry varchar(1)
  3060. , nextbatchno varchar(5)
  3061. , CONSTRAINT rgl_companybatchoptions_KEY0_pk PRIMARY KEY (modulecode,batchtype)
  3062. , CONSTRAINT rgl_companybatchoptions_KEY0_check CHECK (modulecode is not null and batchtype IS NOT NULL)
  3063. ) WITH (OIDS=FALSE);
  3064.  
  3065.  
  3066. CREATE TABLE sageimport.rgl_companymemomanagersettings(
  3067. modulecode varchar(3)
  3068. , memotype varchar(2)
  3069. , role varchar(10)
  3070. , memofunction varchar(30)
  3071. , memooption varchar(1)
  3072. , autodisplay varchar(1)
  3073. , CONSTRAINT rgl_companymemomanagersettings_KEY0_pk PRIMARY KEY (modulecode,memotype,role,memofunction)
  3074. , CONSTRAINT rgl_companymemomanagersettings_KEY0_check CHECK (modulecode is not null and memotype is not null and role is not null and memofunction IS NOT NULL)
  3075. ) WITH (OIDS=FALSE);
  3076.  
  3077.  
  3078. CREATE TABLE sageimport.rgl_dailyposting(
  3079. postingdate date
  3080. , sourcejournal varchar(2)
  3081. , registerno varchar(6)
  3082. , accountkey varchar(9)
  3083. , sequenceno varchar(14)
  3084. , sourcemodule varchar(2)
  3085. , postingcomment text
  3086. , documenttype varchar(1)
  3087. , documentno varchar(20)
  3088. , docsequenceno varchar(14)
  3089. , receiptno varchar(7)
  3090. , batchtype varchar(2)
  3091. , batchno varchar(5)
  3092. , lineseqno varchar(14)
  3093. , apdivisionno varchar(2)
  3094. , vendorno varchar(7)
  3095. , datecreated date
  3096. , timecreated varchar(8)
  3097. , usercreatedkey varchar(10)
  3098. , debitamount numeric(15,4)
  3099. , creditamount numeric(15,4)
  3100. , altdoctype varchar(1)
  3101. , ardivisionno varchar(2)
  3102. , customerno varchar(20)
  3103. , CONSTRAINT rgl_dailyposting_KEY0_pk PRIMARY KEY (postingdate,sourcejournal,registerno,accountkey,sequenceno)
  3104. , CONSTRAINT rgl_dailyposting_KEY0_check CHECK (postingdate is not null and sourcejournal is not null and registerno is not null and accountkey is not null and sequenceno IS NOT NULL)
  3105. , CONSTRAINT rgl_dailyposting_KEY2_unique UNIQUE (sequenceno)
  3106. ) WITH (OIDS=FALSE);
  3107. CREATE INDEX rgl_dailyposting_KEY1_index ON sageimport.rgl_dailyposting (batchno,postingdate,sourcejournal,registerno,accountkey,sequenceno);
  3108. CREATE INDEX rgl_dailyposting_KEY3_index ON sageimport.rgl_dailyposting (accountkey,postingdate,sourcejournal,registerno,sequenceno);
  3109. CREATE INDEX rgl_dailyposting_KEY4_index ON sageimport.rgl_dailyposting (apdivisionno,vendorno,documentno,postingdate,sourcejournal,registerno,accountkey,sequenceno);
  3110. CREATE INDEX rgl_dailyposting_KEY5_index ON sageimport.rgl_dailyposting (ardivisionno,customerno,documentno,postingdate,sourcejournal,registerno,accountkey,sequenceno);
  3111.  
  3112.  
  3113. CREATE TABLE sageimport.rgl_detailposting(
  3114. accountkey varchar(9)
  3115. , postingdate date
  3116. , sourcejournal varchar(2)
  3117. , journalregisterno varchar(6)
  3118. , sequenceno varchar(14)
  3119. , sourcemodule varchar(2)
  3120. , documenttype varchar(1)
  3121. , documentno varchar(20)
  3122. , docsequenceno varchar(14)
  3123. , receiptno varchar(7)
  3124. , batchtype varchar(2)
  3125. , batchno varchar(5)
  3126. , postingcomment text
  3127. , headerrec varchar(1)
  3128. , linebankcode varchar(1)
  3129. , linedocrefer varchar(10)
  3130. , linedate date
  3131. , datecreated date
  3132. , timecreated varchar(8)
  3133. , usercreatedkey varchar(10)
  3134. , debitamount numeric(15,4)
  3135. , creditamount numeric(15,4)
  3136. , CONSTRAINT rgl_detailposting_KEY0_pk PRIMARY KEY (accountkey,postingdate,sourcejournal,journalregisterno,sequenceno)
  3137. , CONSTRAINT rgl_detailposting_KEY0_check CHECK (accountkey is not null and postingdate is not null and sourcejournal is not null and journalregisterno is not null and sequenceno IS NOT NULL)
  3138. , CONSTRAINT rgl_detailposting_KEY2_unique UNIQUE (sequenceno)
  3139. ) WITH (OIDS=FALSE);
  3140. CREATE INDEX rgl_detailposting_KEY1_index ON sageimport.rgl_detailposting (sourcejournal,journalregisterno,postingdate,sequenceno);
  3141. CREATE INDEX rgl_detailposting_KEY3_index ON sageimport.rgl_detailposting (postingdate,accountkey,sourcejournal,journalregisterno,sequenceno);
  3142. CREATE INDEX rgl_detailposting_KEY4_index ON sageimport.rgl_detailposting (sourcemodule,accountkey,postingdate,sourcejournal,journalregisterno,sequenceno);
  3143.  
  3144.  
  3145. CREATE TABLE sageimport.rgl_financialreport(
  3146. reportname varchar(30)
  3147. , reporttitle varchar(50)
  3148. , reporttype varchar(1)
  3149. , reportgroup varchar(20)
  3150. , summarytype varchar(1)
  3151. , columnformat varchar(1)
  3152. , reportperiod varchar(1)
  3153. , trendperiodtype varchar(1)
  3154. , trendfollowingperiod numeric(15,4)
  3155. , trendfirstperiod varchar(1)
  3156. , trendlastperiod varchar(1)
  3157. , budgetcode varchar(10)
  3158. , decimalplaces varchar(1)
  3159. , decimalseparator varchar(1)
  3160. , negativevalueformat varchar(1)
  3161. , thousandseparator varchar(1)
  3162. , percentdecimalplaces varchar(1)
  3163. , percentsymbol varchar(1)
  3164. , roundingfactor varchar(1)
  3165. , printaccountno varchar(1)
  3166. , dollarsigntype varchar(1)
  3167. , printzeroacct varchar(1)
  3168. , liabilitynewpage varchar(1)
  3169. , useruntimeacctsel varchar(1)
  3170. , usecondensedformat varchar(1)
  3171. , useruntimetrendopt varchar(1)
  3172. , footnoteoption varchar(1)
  3173. , centerfootnote varchar(1)
  3174. , useruntimefootnote varchar(1)
  3175. , permanentrecord varchar(1)
  3176. , printuserkey varchar(10)
  3177. , footnotetext text
  3178. , firstamountonly varchar(1)
  3179. , CONSTRAINT rgl_financialreport_KEY0_pk PRIMARY KEY (reportname)
  3180. , CONSTRAINT rgl_financialreport_KEY0_check CHECK (reportname IS NOT NULL)
  3181. ) WITH (OIDS=FALSE);
  3182. CREATE INDEX rgl_financialreport_KEY1_index ON sageimport.rgl_financialreport (reportgroup,reportname);
  3183.  
  3184.  
  3185. CREATE TABLE sageimport.rgl_financialreportgroup(
  3186. groupname varchar(20)
  3187. , sequenceno varchar(14)
  3188. , linekey varchar(6)
  3189. , reportname varchar(30)
  3190. , permanentrecord varchar(1)
  3191. , CONSTRAINT rgl_financialreportgroup_KEY0_pk PRIMARY KEY (groupname,sequenceno,linekey)
  3192. , CONSTRAINT rgl_financialreportgroup_KEY0_check CHECK (groupname is not null and sequenceno is not null and linekey IS NOT NULL)
  3193. ) WITH (OIDS=FALSE);
  3194. CREATE INDEX rgl_financialreportgroup_KEY1_index ON sageimport.rgl_financialreportgroup (groupname,linekey);
  3195.  
  3196.  
  3197. CREATE TABLE sageimport.rgl_financialterminology(
  3198. financialtermcode varchar(6)
  3199. , financialtermdefaultdesc varchar(40)
  3200. , financialtermdesc varchar(40)
  3201. , CONSTRAINT rgl_financialterminology_KEY0_pk PRIMARY KEY (financialtermcode)
  3202. , CONSTRAINT rgl_financialterminology_KEY0_check CHECK (financialtermcode IS NOT NULL)
  3203. ) WITH (OIDS=FALSE);
  3204.  
  3205.  
  3206. CREATE TABLE sageimport.rgl_fiscalyear(
  3207. fiscalyear varchar(4)
  3208. , numberofperiods varchar(2)
  3209. , datecreated date
  3210. , timecreated varchar(8)
  3211. , usercreatedkey varchar(10)
  3212. , dateupdated date
  3213. , timeupdated varchar(8)
  3214. , userupdatedkey varchar(10)
  3215. , CONSTRAINT rgl_fiscalyear_KEY0_pk PRIMARY KEY (fiscalyear)
  3216. , CONSTRAINT rgl_fiscalyear_KEY0_check CHECK (fiscalyear IS NOT NULL)
  3217. ) WITH (OIDS=FALSE);
  3218.  
  3219.  
  3220. CREATE TABLE sageimport.rgl_fiscalyeardetail(
  3221. fiscalyear varchar(4)
  3222. , fiscalperiod varchar(2)
  3223. , periodendingdate date
  3224. , allocationscomp varchar(1)
  3225. , companycode varchar(3)
  3226. , CONSTRAINT rgl_fiscalyeardetail_KEY0_pk PRIMARY KEY (fiscalyear,fiscalperiod)
  3227. , CONSTRAINT rgl_fiscalyeardetail_KEY0_check CHECK (fiscalyear is not null and fiscalperiod IS NOT NULL)
  3228. ) WITH (OIDS=FALSE);
  3229. CREATE INDEX rgl_fiscalyeardetail_KEY1_index ON sageimport.rgl_fiscalyeardetail (periodendingdate,fiscalyear,fiscalperiod);
  3230.  
  3231.  
  3232. CREATE TABLE sageimport.rgl_mainaccount(
  3233. segmentno varchar(2)
  3234. , mainaccountcode varchar(15)
  3235. , mainaccountdesc varchar(40)
  3236. , mainaccountshortdesc varchar(20)
  3237. , datestart date
  3238. , dateend date
  3239. , status varchar(1)
  3240. , clearbalance varchar(1)
  3241. , accountgroup varchar(15)
  3242. , accountcategory varchar(1)
  3243. , accounttype varchar(2)
  3244. , cashflowstype varchar(1)
  3245. , rollupcode1 varchar(20)
  3246. , rollupcode2 varchar(20)
  3247. , rollupcode3 varchar(20)
  3248. , rollupcode4 varchar(20)
  3249. , companycode varchar(3)
  3250. , datecreated date
  3251. , timecreated varchar(8)
  3252. , usercreatedkey varchar(10)
  3253. , dateupdated date
  3254. , timeupdated varchar(8)
  3255. , userupdatedkey varchar(10)
  3256. , CONSTRAINT rgl_mainaccount_KEY0_pk PRIMARY KEY (segmentno,mainaccountcode)
  3257. , CONSTRAINT rgl_mainaccount_KEY0_check CHECK (segmentno is not null and mainaccountcode IS NOT NULL)
  3258. ) WITH (OIDS=FALSE);
  3259. CREATE INDEX rgl_mainaccount_KEY1_index ON sageimport.rgl_mainaccount (mainaccountcode);
  3260. CREATE INDEX rgl_mainaccount_KEY2_index ON sageimport.rgl_mainaccount (rollupcode1,mainaccountcode);
  3261. CREATE INDEX rgl_mainaccount_KEY3_index ON sageimport.rgl_mainaccount (rollupcode2,mainaccountcode);
  3262. CREATE INDEX rgl_mainaccount_KEY4_index ON sageimport.rgl_mainaccount (rollupcode3,mainaccountcode);
  3263. CREATE INDEX rgl_mainaccount_KEY5_index ON sageimport.rgl_mainaccount (rollupcode4,mainaccountcode);
  3264. CREATE INDEX rgl_mainaccount_KEY6_index ON sageimport.rgl_mainaccount (accountgroup,segmentno,mainaccountcode);
  3265. CREATE INDEX rgl_mainaccount_KEY7_index ON sageimport.rgl_mainaccount (status,mainaccountcode);
  3266.  
  3267.  
  3268. CREATE TABLE sageimport.rgl_options(
  3269. modulecode varchar(3)
  3270. , newsystem varchar(1)
  3271. , accountformat varchar(31)
  3272. , currentfiscalyr varchar(4)
  3273. , currentperiod varchar(2)
  3274. , accountmaskdelim varchar(1)
  3275. , accountdescdelim1 varchar(1)
  3276. , accountdescdelim2 varchar(1)
  3277. , retainearningsaccountkey varchar(9)
  3278. , autocreateaccounts varchar(1)
  3279. , allowotfmainaccounts varchar(1)
  3280. , allowotfsubaccounts varchar(1)
  3281. , trackadditionsindetail varchar(1)
  3282. , trackchangestoacct varchar(1)
  3283. , yearsretainglhist varchar(2)
  3284. , resetjournal varchar(1)
  3285. , resetregister varchar(1)
  3286. , trackdeletedjournals varchar(1)
  3287. , nextallocno varchar(7)
  3288. , integratebankrec varchar(1)
  3289. , defaultbudget varchar(10)
  3290. , copyactualtobudget varchar(1)
  3291. , changebudgetamt varchar(1)
  3292. , reversebudvarsignsoncustomfs varchar(1)
  3293. , reversepyvarsignsonfs varchar(1)
  3294. , updateneeded varchar(1)
  3295. , periodupdated varchar(2)
  3296. , currentfiscalyrperiods varchar(2)
  3297. , currentcalendaryr varchar(4)
  3298. , currfiscalyearupdatedtofs varchar(4)
  3299. , tranjrnlpostoption varchar(1)
  3300. , rolluptype1 varchar(20)
  3301. , rolluptype2 varchar(20)
  3302. , rolluptype3 varchar(20)
  3303. , rolluptype4 varchar(20)
  3304. , companycode varchar(3)
  3305. , dataversion numeric(15,4)
  3306. , dateupdated date
  3307. , timeupdated varchar(8)
  3308. , userupdatedkey varchar(10)
  3309. , datasublevel numeric(15,4)
  3310. , CONSTRAINT rgl_options_KEY0_pk PRIMARY KEY (modulecode)
  3311. , CONSTRAINT rgl_options_KEY0_check CHECK (modulecode IS NOT NULL)
  3312. ) WITH (OIDS=FALSE);
  3313.  
  3314.  
  3315. CREATE TABLE sageimport.rgl_periodpostinghistory(
  3316. accountkey varchar(9)
  3317. , fiscalyear varchar(4)
  3318. , fiscalperiod varchar(2)
  3319. , beginningbalance numeric(15,4)
  3320. , debitamount numeric(15,4)
  3321. , creditamount numeric(15,4)
  3322. , CONSTRAINT rgl_periodpostinghistory_KEY0_pk PRIMARY KEY (accountkey,fiscalyear,fiscalperiod)
  3323. , CONSTRAINT rgl_periodpostinghistory_KEY0_check CHECK (accountkey is not null and fiscalyear is not null and fiscalperiod IS NOT NULL)
  3324. ) WITH (OIDS=FALSE);
  3325. CREATE INDEX rgl_periodpostinghistory_KEY1_index ON sageimport.rgl_periodpostinghistory (fiscalyear,fiscalperiod,accountkey);
  3326. CREATE INDEX rgl_periodpostinghistory_KEY2_index ON sageimport.rgl_periodpostinghistory (fiscalyear,accountkey,fiscalperiod);
  3327. CREATE INDEX rgl_periodpostinghistory_KEY3_index ON sageimport.rgl_periodpostinghistory (fiscalyear,fiscalperiod,accountkey);
  3328.  
  3329.  
  3330. CREATE TABLE sageimport.rgl_salestax(
  3331. taxcode varchar(15)
  3332. , registrationno varchar(20)
  3333. , exemptionno varchar(20)
  3334. , arsalestaxaccountkey varchar(9)
  3335. , apsalestaxaccountkey varchar(9)
  3336. , apusetaxaccountkey varchar(9)
  3337. , nonrecoverytaxaccountkey varchar(9)
  3338. , expensetax varchar(1)
  3339. , CONSTRAINT rgl_salestax_KEY0_pk PRIMARY KEY (taxcode)
  3340. , CONSTRAINT rgl_salestax_KEY0_check CHECK (taxcode IS NOT NULL)
  3341. ) WITH (OIDS=FALSE);
  3342.  
  3343.  
  3344. CREATE TABLE sageimport.rgl_sourcejournal(
  3345. sourcejournal varchar(2)
  3346. , sourcejournaldesc varchar(40)
  3347. , journaltype varchar(1)
  3348. , nextjournalno varchar(6)
  3349. , nextregisterno varchar(6)
  3350. , offsetaccountkey varchar(9)
  3351. , ooffset varchar(1)
  3352. , enterbatchtotfortransjrnlde varchar(1)
  3353. , transactiontype varchar(1)
  3354. , autoincrementcheck varchar(1)
  3355. , postbrdepositinsummary varchar(1)
  3356. , bankcode varchar(1)
  3357. , transferfundstobankcode varchar(1)
  3358. , CONSTRAINT rgl_sourcejournal_KEY0_pk PRIMARY KEY (sourcejournal)
  3359. , CONSTRAINT rgl_sourcejournal_KEY0_check CHECK (sourcejournal IS NOT NULL)
  3360. ) WITH (OIDS=FALSE);
  3361.  
  3362.  
  3363. CREATE TABLE sageimport.rgl_sourcejournalhistory(
  3364. sourcejournal varchar(2)
  3365. , journalregisterno varchar(6)
  3366. , postingdate date
  3367. , sourcemodule varchar(2)
  3368. , deleted varchar(1)
  3369. , dateupdated date
  3370. , timeupdated varchar(8)
  3371. , userupdatedkey varchar(10)
  3372. , debitamount numeric(15,4)
  3373. , creditamount numeric(15,4)
  3374. , CONSTRAINT rgl_sourcejournalhistory_KEY0_pk PRIMARY KEY (sourcejournal,journalregisterno,postingdate,sourcemodule)
  3375. , CONSTRAINT rgl_sourcejournalhistory_KEY0_check CHECK (sourcejournal is not null and journalregisterno is not null and postingdate is not null and sourcemodule IS NOT NULL)
  3376. ) WITH (OIDS=FALSE);
  3377. CREATE INDEX rgl_sourcejournalhistory_KEY1_index ON sageimport.rgl_sourcejournalhistory (sourcejournal,postingdate);
  3378. CREATE INDEX rgl_sourcejournalhistory_KEY2_index ON sageimport.rgl_sourcejournalhistory (postingdate,sourcejournal,journalregisterno,sourcemodule);
  3379.  
  3380.  
  3381. CREATE TABLE sageimport.rgl_subaccount(
  3382. segmentno varchar(2)
  3383. , subaccountcode varchar(15)
  3384. , subaccountdesc varchar(40)
  3385. , subaccountshortdesc varchar(10)
  3386. , printfinancialstmts varchar(1)
  3387. , datestart date
  3388. , dateend date
  3389. , status varchar(1)
  3390. , datecreated date
  3391. , timecreated varchar(8)
  3392. , usercreatedkey varchar(10)
  3393. , dateupdated date
  3394. , timeupdated varchar(8)
  3395. , userupdatedkey varchar(10)
  3396. , CONSTRAINT rgl_subaccount_KEY0_pk PRIMARY KEY (segmentno,subaccountcode)
  3397. , CONSTRAINT rgl_subaccount_KEY0_check CHECK (segmentno is not null and subaccountcode IS NOT NULL)
  3398. ) WITH (OIDS=FALSE);
  3399. CREATE INDEX rgl_subaccount_KEY1_index ON sageimport.rgl_subaccount (status,segmentno,subaccountcode);
  3400.  
  3401.  
  3402. CREATE TABLE sageimport.rgl_summarydetaildrilldown(
  3403. accountkey varchar(9)
  3404. , postingdate date
  3405. , sourcejournal varchar(2)
  3406. , registerno varchar(6)
  3407. , documentno varchar(20)
  3408. , sequenceno varchar(14)
  3409. , sourcemodule varchar(2)
  3410. , documenttype varchar(1)
  3411. , receiptno varchar(7)
  3412. , docsequenceno varchar(14)
  3413. , altdoctype varchar(1)
  3414. , apdivisionno varchar(2)
  3415. , vendorno varchar(7)
  3416. , ardivisionno varchar(2)
  3417. , customerno varchar(20)
  3418. , CONSTRAINT rgl_summarydetaildrilldown_KEY0_pk PRIMARY KEY (accountkey,postingdate,sourcejournal,registerno,documentno,sequenceno)
  3419. , CONSTRAINT rgl_summarydetaildrilldown_KEY0_check CHECK (accountkey is not null and postingdate is not null and sourcejournal is not null and registerno is not null and documentno is not null and sequenceno IS NOT NULL)
  3420. ) WITH (OIDS=FALSE);
  3421. CREATE INDEX rgl_summarydetaildrilldown_KEY1_index ON sageimport.rgl_summarydetaildrilldown (postingdate,accountkey,sourcejournal,registerno,documentno,sequenceno);
  3422. CREATE INDEX rgl_summarydetaildrilldown_KEY2_index ON sageimport.rgl_summarydetaildrilldown (apdivisionno,vendorno,documentno,postingdate,sourcejournal,registerno,accountkey,sequenceno);
  3423. CREATE INDEX rgl_summarydetaildrilldown_KEY3_index ON sageimport.rgl_summarydetaildrilldown (ardivisionno,customerno,documentno,postingdate,sourcejournal,registerno,accountkey,sequenceno);
  3424.  
  3425.  
  3426. CREATE TABLE sageimport.rim_aliasitem(
  3427. itemcode varchar(30)
  3428. , aliasitemno varchar(30)
  3429. , ttype varchar(1)
  3430. , ardivisionno varchar(2)
  3431. , customerno varchar(20)
  3432. , apdivisionno varchar(2)
  3433. , vendorno varchar(7)
  3434. , aliasitemdesc varchar(30)
  3435. , datecreated date
  3436. , timecreated varchar(8)
  3437. , usercreatedkey varchar(10)
  3438. , dateupdated date
  3439. , timeupdated varchar(8)
  3440. , userupdatedkey varchar(10)
  3441. , CONSTRAINT rim_aliasitem_KEY0_pk PRIMARY KEY (itemcode,aliasitemno,ttype,ardivisionno,customerno,apdivisionno,vendorno)
  3442. , CONSTRAINT rim_aliasitem_KEY0_check CHECK (itemcode is not null and aliasitemno is not null and ttype is not null and ardivisionno is not null and customerno is not null and apdivisionno is not null and vendorno IS NOT NULL)
  3443. ) WITH (OIDS=FALSE);
  3444. CREATE INDEX rim_aliasitem_KEY1_index ON sageimport.rim_aliasitem (aliasitemno,itemcode,ttype,ardivisionno,customerno,apdivisionno,vendorno);
  3445. CREATE INDEX rim_aliasitem_KEY2_index ON sageimport.rim_aliasitem (ttype,ardivisionno,customerno,aliasitemno,itemcode,apdivisionno,vendorno);
  3446. CREATE INDEX rim_aliasitem_KEY3_index ON sageimport.rim_aliasitem (ttype,apdivisionno,vendorno,aliasitemno,itemcode,ardivisionno,customerno);
  3447. CREATE INDEX rim_aliasitem_KEY4_index ON sageimport.rim_aliasitem (ttype,ardivisionno,customerno,itemcode,aliasitemno,apdivisionno,vendorno);
  3448. CREATE INDEX rim_aliasitem_KEY5_index ON sageimport.rim_aliasitem (ttype,apdivisionno,vendorno,itemcode,aliasitemno,ardivisionno,customerno);
  3449. CREATE INDEX rim_aliasitem_KEY6_index ON sageimport.rim_aliasitem (itemcode,ttype,ardivisionno,customerno,aliasitemno);
  3450.  
  3451.  
  3452. CREATE TABLE sageimport.rim_countcarddefaults(
  3453. userkey varchar(10)
  3454. , workstationname varchar(30)
  3455. , warehousecode varchar(3)
  3456. , includealllotserialno varchar(1)
  3457. , unitofmeasureforqty varchar(1)
  3458. , CONSTRAINT rim_countcarddefaults_KEY0_pk PRIMARY KEY (userkey,workstationname)
  3459. , CONSTRAINT rim_countcarddefaults_KEY0_check CHECK (userkey is not null and workstationname IS NOT NULL)
  3460. ) WITH (OIDS=FALSE);
  3461. CREATE INDEX rim_countcarddefaults_KEY1_index ON sageimport.rim_countcarddefaults (workstationname,userkey);
  3462.  
  3463.  
  3464. CREATE TABLE sageimport.rim_dailypostingwork(
  3465. postingdate date
  3466. , sourcejournal varchar(2)
  3467. , registerno varchar(6)
  3468. , accountkey varchar(9)
  3469. , sequenceno varchar(14)
  3470. , sourcemodule varchar(2)
  3471. , postingcomment text
  3472. , documenttype varchar(1)
  3473. , documentno varchar(10)
  3474. , docsequenceno varchar(14)
  3475. , receiptno varchar(7)
  3476. , batchtype varchar(2)
  3477. , batchno varchar(5)
  3478. , lineseqno varchar(14)
  3479. , apdivisionno varchar(2)
  3480. , vendorno varchar(7)
  3481. , ardivisionno varchar(2)
  3482. , customerno varchar(20)
  3483. , debitamount numeric(15,4)
  3484. , creditamount numeric(15,4)
  3485. , CONSTRAINT rim_dailypostingwork_KEY0_pk PRIMARY KEY (postingdate,sourcejournal,registerno,accountkey,sequenceno)
  3486. , CONSTRAINT rim_dailypostingwork_KEY0_check CHECK (postingdate is not null and sourcejournal is not null and registerno is not null and accountkey is not null and sequenceno IS NOT NULL)
  3487. , CONSTRAINT rim_dailypostingwork_KEY1_unique UNIQUE (sequenceno)
  3488. ) WITH (OIDS=FALSE);
  3489. CREATE INDEX rim_dailypostingwork_KEY2_index ON sageimport.rim_dailypostingwork (registerno,postingdate,sourcejournal,accountkey,sequenceno);
  3490. CREATE INDEX rim_dailypostingwork_KEY3_index ON sageimport.rim_dailypostingwork (accountkey,postingdate,sourcejournal,registerno,sequenceno);
  3491.  
  3492.  
  3493. CREATE TABLE sageimport.rim_deletechangeitemswork(
  3494. lineno varchar(14)
  3495. , sequenceno varchar(14)
  3496. , sourceprimary varchar(30)
  3497. , destinationprimary varchar(30)
  3498. , changestatus varchar(70)
  3499. , operation varchar(1)
  3500. , allfiles varchar(1)
  3501. , deleteitems varchar(1)
  3502. , deleteitemwarehouses varchar(1)
  3503. , deleteitemcosting varchar(1)
  3504. , deletealternateitems varchar(1)
  3505. , deleteitempricing varchar(1)
  3506. , deleteebmitemscategories varchar(1)
  3507. , startingitemcode varchar(30)
  3508. , startingitemcodedesc varchar(30)
  3509. , endingitemcode varchar(30)
  3510. , endingitemcodedesc varchar(30)
  3511. , newitemcode varchar(30)
  3512. , newitemcodedesc varchar(30)
  3513. , CONSTRAINT rim_deletechangeitemswork_KEY0_pk PRIMARY KEY (operation,lineno,sequenceno)
  3514. , CONSTRAINT rim_deletechangeitemswork_KEY0_check CHECK (operation is not null and lineno is not null and sequenceno IS NOT NULL)
  3515. ) WITH (OIDS=FALSE);
  3516. CREATE INDEX rim_deletechangeitemswork_KEY1_index ON sageimport.rim_deletechangeitemswork (sourceprimary,destinationprimary,lineno);
  3517.  
  3518.  
  3519. CREATE TABLE sageimport.rim_itemcost(
  3520. itemcode varchar(30)
  3521. , warehousecode varchar(3)
  3522. , tiertype varchar(1)
  3523. , groupsort varchar(16)
  3524. , transactiondate date
  3525. , receiptdate date
  3526. , receiptno varchar(8)
  3527. , lotserialno varchar(15)
  3528. , negativeqty varchar(1)
  3529. , tiergroup varchar(1)
  3530. , quantityonhand numeric(15,4)
  3531. , unitcost numeric(15,4)
  3532. , allocatedcost numeric(15,4)
  3533. , extendedcost numeric(15,4)
  3534. , quantitycommitted numeric(15,4)
  3535. , costcalcqtycommitted numeric(15,4)
  3536. , costcalccostcommitted numeric(15,4)
  3537. , datecreated date
  3538. , timecreated varchar(8)
  3539. , usercreatedkey varchar(10)
  3540. , dateupdated date
  3541. , timeupdated varchar(8)
  3542. , userupdatedkey varchar(10)
  3543. , CONSTRAINT rim_itemcost_KEY0_pk PRIMARY KEY (itemcode,warehousecode,tiertype,groupsort)
  3544. , CONSTRAINT rim_itemcost_KEY0_check CHECK (itemcode is not null and warehousecode is not null and tiertype is not null and groupsort IS NOT NULL)
  3545. ) WITH (OIDS=FALSE);
  3546. CREATE INDEX rim_itemcost_KEY1_index ON sageimport.rim_itemcost (itemcode,warehousecode,tiertype,receiptdate,receiptno,lotserialno,groupsort);
  3547. CREATE INDEX rim_itemcost_KEY2_index ON sageimport.rim_itemcost (negativeqty,tiergroup,itemcode,warehousecode,tiertype,groupsort);
  3548.  
  3549.  
  3550. CREATE TABLE sageimport.rim_itemcustomerhistorybyperiod(
  3551. ardivisionno varchar(2)
  3552. , customerno varchar(20)
  3553. , shiptocode varchar(4)
  3554. , itemcode varchar(30)
  3555. , fiscalcalyear varchar(4)
  3556. , fiscalcalperiod varchar(2)
  3557. , quantitysold numeric(15,4)
  3558. , dollarssold numeric(15,4)
  3559. , costofgoodssold numeric(15,4)
  3560. , quantityreturned numeric(15,4)
  3561. , dateupdated date
  3562. , timeupdated varchar(8)
  3563. , userupdatedkey varchar(10)
  3564. , CONSTRAINT rim_itemcustomerhistorybyperiod_KEY0_pk PRIMARY KEY (ardivisionno,customerno,shiptocode,itemcode,fiscalcalyear,fiscalcalperiod)
  3565. , CONSTRAINT rim_itemcustomerhistorybyperiod_KEY0_check CHECK (ardivisionno is not null and customerno is not null and shiptocode is not null and itemcode is not null and fiscalcalyear is not null and fiscalcalperiod IS NOT NULL)
  3566. ) WITH (OIDS=FALSE);
  3567. CREATE INDEX rim_itemcustomerhistorybyperiod_KEY1_index ON sageimport.rim_itemcustomerhistorybyperiod (itemcode,ardivisionno,customerno,shiptocode,fiscalcalyear,fiscalcalperiod);
  3568. CREATE INDEX rim_itemcustomerhistorybyperiod_KEY2_index ON sageimport.rim_itemcustomerhistorybyperiod (itemcode,fiscalcalyear,fiscalcalperiod,ardivisionno,customerno,shiptocode);
  3569. CREATE INDEX rim_itemcustomerhistorybyperiod_KEY3_index ON sageimport.rim_itemcustomerhistorybyperiod (ardivisionno,customerno,shiptocode,fiscalcalyear,fiscalcalperiod,itemcode);
  3570. CREATE INDEX rim_itemcustomerhistorybyperiod_KEY4_index ON sageimport.rim_itemcustomerhistorybyperiod (ardivisionno,customerno,fiscalcalyear,fiscalcalperiod,shiptocode,itemcode);
  3571. CREATE INDEX rim_itemcustomerhistorybyperiod_KEY5_index ON sageimport.rim_itemcustomerhistorybyperiod (ardivisionno,customerno,itemcode,fiscalcalyear,fiscalcalperiod,shiptocode);
  3572. CREATE INDEX rim_itemcustomerhistorybyperiod_KEY6_index ON sageimport.rim_itemcustomerhistorybyperiod (itemcode,fiscalcalyear,ardivisionno,customerno,shiptocode,fiscalcalperiod);
  3573. CREATE INDEX rim_itemcustomerhistorybyperiod_KEY7_index ON sageimport.rim_itemcustomerhistorybyperiod (ardivisionno,customerno,fiscalcalyear,itemcode,shiptocode,fiscalcalperiod);
  3574. CREATE INDEX rim_itemcustomerhistorybyperiod_KEY8_index ON sageimport.rim_itemcustomerhistorybyperiod (ardivisionno,customerno,itemcode,shiptocode,fiscalcalyear,fiscalcalperiod);
  3575.  
  3576.  
  3577. CREATE TABLE sageimport.rim_itemmemo(
  3578. itemcode varchar(30)
  3579. , memocode varchar(10)
  3580. , seqno varchar(6)
  3581. , memodesc varchar(30)
  3582. , memodate date
  3583. , expirationdate date
  3584. , reminderstartdate date
  3585. , reminderenddate date
  3586. , autodisplaysetting varchar(1)
  3587. , memotext text
  3588. , attachment varchar(128)
  3589. , datecreated date
  3590. , timecreated varchar(8)
  3591. , usercreatedkey varchar(10)
  3592. , dateupdated date
  3593. , timeupdated varchar(8)
  3594. , userupdatedkey varchar(10)
  3595. , CONSTRAINT rim_itemmemo_KEY0_pk PRIMARY KEY (itemcode,memocode,seqno)
  3596. , CONSTRAINT rim_itemmemo_KEY0_check CHECK (itemcode is not null and memocode is not null and seqno IS NOT NULL)
  3597. ) WITH (OIDS=FALSE);
  3598.  
  3599.  
  3600. CREATE TABLE sageimport.rim_itemtransactionhistory(
  3601. itemcode varchar(30)
  3602. , warehousecode varchar(3)
  3603. , transactiondate date
  3604. , transactioncode varchar(2)
  3605. , entryno varchar(10)
  3606. , sequenceno varchar(6)
  3607. , imtransactionentrycomment varchar(30)
  3608. , apdivisionno varchar(2)
  3609. , vendorno varchar(7)
  3610. , ardivisionno varchar(2)
  3611. , customerno varchar(20)
  3612. , referencedate date
  3613. , fiscalcalyear varchar(4)
  3614. , fiscalcalperiod varchar(2)
  3615. , shiptocode varchar(4)
  3616. , invoicetype varchar(2)
  3617. , transactionqty numeric(15,4)
  3618. , unitcost numeric(15,4)
  3619. , allocatedcost numeric(15,4)
  3620. , unitprice numeric(15,4)
  3621. , extendedprice numeric(15,4)
  3622. , extendedcost numeric(15,4)
  3623. , extendedstandardcost numeric(15,4)
  3624. , dateupdated date
  3625. , timeupdated varchar(8)
  3626. , userupdatedkey varchar(10)
  3627. , invoicehistoryheaderseqno varchar(6)
  3628. , receipthistoryheaderseqno varchar(6)
  3629. , receipthistorypurchaseorderno varchar(7)
  3630. , sourcejournal varchar(2)
  3631. , journalnoglbatchno varchar(6)
  3632. , CONSTRAINT rim_itemtransactionhistory_KEY0_pk PRIMARY KEY (itemcode,warehousecode,transactiondate,transactioncode,entryno,sequenceno)
  3633. , CONSTRAINT rim_itemtransactionhistory_KEY0_check CHECK (itemcode is not null and warehousecode is not null and transactiondate is not null and transactioncode is not null and entryno is not null and sequenceno IS NOT NULL)
  3634. ) WITH (OIDS=FALSE);
  3635. CREATE INDEX rim_itemtransactionhistory_KEY1_index ON sageimport.rim_itemtransactionhistory (itemcode,fiscalcalyear,fiscalcalperiod,warehousecode,transactiondate,transactioncode,entryno,sequenceno);
  3636. CREATE INDEX rim_itemtransactionhistory_KEY2_index ON sageimport.rim_itemtransactionhistory (transactiondate,itemcode,warehousecode,transactioncode,entryno,sequenceno);
  3637.  
  3638.  
  3639. CREATE TABLE sageimport.rim_itemtransactionrecalc(
  3640. itemcode varchar(30)
  3641. , warehousecode varchar(3)
  3642. , transactiondate date
  3643. , transactioncode varchar(2)
  3644. , entryno varchar(10)
  3645. , sequenceno varchar(6)
  3646. , imtransactionentrycomment varchar(30)
  3647. , apdivisionno varchar(2)
  3648. , vendorno varchar(7)
  3649. , ardivisionno varchar(2)
  3650. , customerno varchar(20)
  3651. , referencedate date
  3652. , fiscalcalyear varchar(4)
  3653. , fiscalcalperiod varchar(2)
  3654. , shiptocode varchar(4)
  3655. , invoicetype varchar(2)
  3656. , transactionqty numeric(15,4)
  3657. , unitcost numeric(15,4)
  3658. , allocatedcost numeric(15,4)
  3659. , unitprice numeric(15,4)
  3660. , extendedprice numeric(15,4)
  3661. , extendedcost numeric(15,4)
  3662. , extendedstandardcost numeric(15,4)
  3663. , dateupdated date
  3664. , timeupdated varchar(8)
  3665. , userupdatedkey varchar(10)
  3666. , CONSTRAINT rim_itemtransactionrecalc_KEY0_pk PRIMARY KEY (itemcode,warehousecode,transactiondate,transactioncode,entryno,sequenceno)
  3667. , CONSTRAINT rim_itemtransactionrecalc_KEY0_check CHECK (itemcode is not null and warehousecode is not null and transactiondate is not null and transactioncode is not null and entryno is not null and sequenceno IS NOT NULL)
  3668. ) WITH (OIDS=FALSE);
  3669. CREATE INDEX rim_itemtransactionrecalc_KEY1_index ON sageimport.rim_itemtransactionrecalc (itemcode,fiscalcalyear,fiscalcalperiod,warehousecode,transactiondate,transactioncode,entryno,sequenceno);
  3670. CREATE INDEX rim_itemtransactionrecalc_KEY2_index ON sageimport.rim_itemtransactionrecalc (transactiondate,itemcode,warehousecode,transactioncode,entryno,sequenceno);
  3671.  
  3672.  
  3673. CREATE TABLE sageimport.rim_itemvendor(
  3674. itemcode varchar(30)
  3675. , apdivisionno varchar(2)
  3676. , vendorno varchar(7)
  3677. , vendoraliasitemno varchar(30)
  3678. , lastreceiptdate date
  3679. , lastreceiptno varchar(6)
  3680. , lastreceiptheaderseqno varchar(6)
  3681. , lastreturndate date
  3682. , lastreturnpurchaseorderno varchar(7)
  3683. , lastreturntype varchar(1)
  3684. , lastreceiptpurchaseorderno varchar(7)
  3685. , lastreceipttype varchar(1)
  3686. , lastreturnno varchar(6)
  3687. , lastreturnheaderseqno varchar(6)
  3688. , vendorwarrantycode varchar(10)
  3689. , lastreceiptquantity numeric(15,4)
  3690. , lastunitcost numeric(15,4)
  3691. , lastallocatedunitcost numeric(15,4)
  3692. , standardleadtime numeric(15,4)
  3693. , lastleadtime numeric(15,4)
  3694. , datecreated date
  3695. , timecreated varchar(8)
  3696. , usercreatedkey varchar(10)
  3697. , dateupdated date
  3698. , timeupdated varchar(8)
  3699. , userupdatedkey varchar(10)
  3700. , CONSTRAINT rim_itemvendor_KEY0_pk PRIMARY KEY (itemcode,apdivisionno,vendorno)
  3701. , CONSTRAINT rim_itemvendor_KEY0_check CHECK (itemcode is not null and apdivisionno is not null and vendorno IS NOT NULL)
  3702. ) WITH (OIDS=FALSE);
  3703. CREATE INDEX rim_itemvendor_KEY1_index ON sageimport.rim_itemvendor (apdivisionno,vendorno,itemcode);
  3704.  
  3705.  
  3706. CREATE TABLE sageimport.rim_itemvendorhistorybyperiod(
  3707. apdivisionno varchar(2)
  3708. , vendorno varchar(7)
  3709. , itemcode varchar(30)
  3710. , fiscalcalyear varchar(4)
  3711. , fiscalcalperiod varchar(2)
  3712. , quantityreceived numeric(15,4)
  3713. , costofgoodsreceived numeric(15,4)
  3714. , quantityreturned numeric(15,4)
  3715. , dateupdated date
  3716. , timeupdated varchar(8)
  3717. , userupdatedkey varchar(10)
  3718. , CONSTRAINT rim_itemvendorhistorybyperiod_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,itemcode,fiscalcalyear,fiscalcalperiod)
  3719. , CONSTRAINT rim_itemvendorhistorybyperiod_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and itemcode is not null and fiscalcalyear is not null and fiscalcalperiod IS NOT NULL)
  3720. ) WITH (OIDS=FALSE);
  3721. CREATE INDEX rim_itemvendorhistorybyperiod_KEY1_index ON sageimport.rim_itemvendorhistorybyperiod (itemcode,apdivisionno,vendorno,fiscalcalyear,fiscalcalperiod);
  3722. CREATE INDEX rim_itemvendorhistorybyperiod_KEY2_index ON sageimport.rim_itemvendorhistorybyperiod (itemcode,fiscalcalyear,fiscalcalperiod,apdivisionno,vendorno);
  3723. CREATE INDEX rim_itemvendorhistorybyperiod_KEY3_index ON sageimport.rim_itemvendorhistorybyperiod (apdivisionno,vendorno,fiscalcalyear,fiscalcalperiod,itemcode);
  3724. CREATE INDEX rim_itemvendorhistorybyperiod_KEY4_index ON sageimport.rim_itemvendorhistorybyperiod (itemcode,fiscalcalyear,apdivisionno,vendorno,fiscalcalperiod);
  3725. CREATE INDEX rim_itemvendorhistorybyperiod_KEY5_index ON sageimport.rim_itemvendorhistorybyperiod (apdivisionno,vendorno,fiscalcalyear,itemcode,fiscalcalperiod);
  3726.  
  3727.  
  3728. CREATE TABLE sageimport.rim_itemwarehouse(
  3729. itemcode varchar(30)
  3730. , warehousecode varchar(3)
  3731. , binlocation varchar(10)
  3732. , reordermethod varchar(1)
  3733. , economicorderqty numeric(15,4)
  3734. , reorderpointqty numeric(15,4)
  3735. , minimumorderqty numeric(15,4)
  3736. , maximumonhandqty numeric(15,4)
  3737. , quantityonhand numeric(15,4)
  3738. , quantityonpurchaseorder numeric(15,4)
  3739. , quantityonsalesorder numeric(15,4)
  3740. , quantityonbackorder numeric(15,4)
  3741. , averagecost numeric(15,4)
  3742. , quantityonworkorder numeric(15,4)
  3743. , quantityrequiredforwo numeric(15,4)
  3744. , quantityinshipping numeric(15,4)
  3745. , totalwarehousevalue numeric(15,4)
  3746. , costcalcqtycommitted numeric(15,4)
  3747. , costcalccostcommitted numeric(15,4)
  3748. , datecreated date
  3749. , timecreated varchar(8)
  3750. , usercreatedkey varchar(10)
  3751. , dateupdated date
  3752. , timeupdated varchar(8)
  3753. , userupdatedkey varchar(10)
  3754. , lastphysicalcountdate date
  3755. , CONSTRAINT rim_itemwarehouse_KEY0_pk PRIMARY KEY (itemcode,warehousecode)
  3756. , CONSTRAINT rim_itemwarehouse_KEY0_check CHECK (itemcode is not null and warehousecode IS NOT NULL)
  3757. ) WITH (OIDS=FALSE);
  3758. CREATE INDEX rim_itemwarehouse_KEY1_index ON sageimport.rim_itemwarehouse (warehousecode,binlocation,itemcode);
  3759.  
  3760.  
  3761. CREATE TABLE sageimport.rim_options(
  3762. modulecode varchar(3)
  3763. , newsystem varchar(1)
  3764. , requiremultiplewarehouses varchar(1)
  3765. , reorderbywhse varchar(1)
  3766. , segmentforwhsepostings varchar(1)
  3767. , posttoglbywhse varchar(1)
  3768. , defaultwarehousecode varchar(3)
  3769. , quantityavailabletoinclude varchar(1)
  3770. , calculatecommbyitem varchar(1)
  3771. , trackwhsetransfersasissues varchar(1)
  3772. , baseinventoryperiodson varchar(1)
  3773. , currentperiod varchar(2)
  3774. , currentcalendaryr varchar(4)
  3775. , currentfiscalyr varchar(4)
  3776. , enablewarrantytracking varchar(1)
  3777. , category1desc varchar(15)
  3778. , category2desc varchar(15)
  3779. , category3desc varchar(15)
  3780. , category4desc varchar(15)
  3781. , trackitemchanges varchar(1)
  3782. , trackadditionsindetail varchar(1)
  3783. , printreceiptlabels varchar(1)
  3784. , integrategeneralledger varchar(1)
  3785. , integratejobcost varchar(1)
  3786. , nextsalesentryno varchar(8)
  3787. , nextissueentryno varchar(8)
  3788. , nexttransferentryno varchar(8)
  3789. , nextadjustmententryno varchar(8)
  3790. , nextreceiptsentryno varchar(8)
  3791. , companycode varchar(3)
  3792. , dataversion numeric(15,4)
  3793. , datasublevel numeric(15,4)
  3794. , dateupdated date
  3795. , timeupdated varchar(8)
  3796. , userupdatedkey varchar(10)
  3797. , nextcountcardno varchar(10)
  3798. , defaultunitofmeasureforqty varchar(1)
  3799. , CONSTRAINT rim_options_KEY0_pk PRIMARY KEY (modulecode)
  3800. , CONSTRAINT rim_options_KEY0_check CHECK (modulecode IS NOT NULL)
  3801. ) WITH (OIDS=FALSE);
  3802.  
  3803.  
  3804. CREATE TABLE sageimport.rim_periodpostinghistory(
  3805. itemcode varchar(30)
  3806. , warehousecode varchar(3)
  3807. , fiscalcalyear varchar(4)
  3808. , fiscalcalperiod varchar(2)
  3809. , beginningbalqty numeric(15,4)
  3810. , beginningbaldollaramt numeric(15,4)
  3811. , beginningbalextendedstdcost numeric(15,4)
  3812. , periodchangeqty numeric(15,4)
  3813. , periodchangedollaramt numeric(15,4)
  3814. , periodchangeextendedstdcost numeric(15,4)
  3815. , CONSTRAINT rim_periodpostinghistory_KEY0_pk PRIMARY KEY (itemcode,warehousecode,fiscalcalyear,fiscalcalperiod)
  3816. , CONSTRAINT rim_periodpostinghistory_KEY0_check CHECK (itemcode is not null and warehousecode is not null and fiscalcalyear is not null and fiscalcalperiod IS NOT NULL)
  3817. ) WITH (OIDS=FALSE);
  3818. CREATE INDEX rim_periodpostinghistory_KEY1_index ON sageimport.rim_periodpostinghistory (fiscalcalyear,fiscalcalperiod,itemcode,warehousecode);
  3819. CREATE INDEX rim_periodpostinghistory_KEY2_index ON sageimport.rim_periodpostinghistory (fiscalcalyear,itemcode,fiscalcalperiod,warehousecode);
  3820. CREATE INDEX rim_periodpostinghistory_KEY3_index ON sageimport.rim_periodpostinghistory (fiscalcalyear,itemcode,warehousecode,fiscalcalperiod);
  3821.  
  3822.  
  3823. CREATE TABLE sageimport.rim_physicaldefaults(
  3824. defaultskey varchar(1)
  3825. , sortoption varchar(1)
  3826. , CONSTRAINT rim_physicaldefaults_KEY0_pk PRIMARY KEY (defaultskey)
  3827. , CONSTRAINT rim_physicaldefaults_KEY0_check CHECK (defaultskey IS NOT NULL)
  3828. ) WITH (OIDS=FALSE);
  3829.  
  3830.  
  3831. CREATE TABLE sageimport.rim_pricecode(
  3832. pricecoderecord varchar(1)
  3833. , pricecode varchar(4)
  3834. , itemcode varchar(30)
  3835. , customerpricelevel varchar(1)
  3836. , ardivisionno varchar(2)
  3837. , customerno varchar(20)
  3838. , pricecodedesc varchar(25)
  3839. , pricingmethod varchar(1)
  3840. , breakquantity1 numeric(15,4)
  3841. , breakquantity2 numeric(15,4)
  3842. , breakquantity3 numeric(15,4)
  3843. , breakquantity4 numeric(15,4)
  3844. , breakquantity5 numeric(15,4)
  3845. , discountmarkup1 numeric(15,4)
  3846. , discountmarkup2 numeric(15,4)
  3847. , discountmarkup3 numeric(15,4)
  3848. , discountmarkup4 numeric(15,4)
  3849. , discountmarkup5 numeric(15,4)
  3850. , datecreated date
  3851. , timecreated varchar(8)
  3852. , usercreatedkey varchar(10)
  3853. , dateupdated date
  3854. , timeupdated varchar(8)
  3855. , userupdatedkey varchar(10)
  3856. , CONSTRAINT rim_pricecode_KEY0_pk PRIMARY KEY (pricecoderecord,pricecode,itemcode,customerpricelevel,ardivisionno,customerno)
  3857. , CONSTRAINT rim_pricecode_KEY0_check CHECK (pricecoderecord is not null and pricecode is not null and itemcode is not null and customerpricelevel is not null and ardivisionno is not null and customerno IS NOT NULL)
  3858. ) WITH (OIDS=FALSE);
  3859. CREATE INDEX rim_pricecode_KEY1_index ON sageimport.rim_pricecode (itemcode,pricecoderecord,pricecode,customerpricelevel,ardivisionno,customerno);
  3860. CREATE INDEX rim_pricecode_KEY2_index ON sageimport.rim_pricecode (itemcode,pricecoderecord,customerpricelevel,ardivisionno,customerno,pricecode);
  3861. CREATE INDEX rim_pricecode_KEY3_index ON sageimport.rim_pricecode (itemcode,pricecoderecord,customerpricelevel,ardivisionno,customerno,pricecode);
  3862. CREATE INDEX rim_pricecode_KEY4_index ON sageimport.rim_pricecode (ardivisionno,customerno,itemcode,pricecoderecord,pricecode,customerpricelevel);
  3863.  
  3864.  
  3865. CREATE TABLE sageimport.rim_productline(
  3866. productline varchar(4)
  3867. , productlinedesc varchar(25)
  3868. , producttype varchar(1)
  3869. , valuation varchar(1)
  3870. , pricecode varchar(4)
  3871. , allowbackorders varchar(1)
  3872. , explodekititems varchar(1)
  3873. , calculatecommission varchar(1)
  3874. , standardunitofmeasure varchar(4)
  3875. , purchaseunitofmeasure varchar(4)
  3876. , salesunitofmeasure varchar(4)
  3877. , procurementtype varchar(1)
  3878. , inventorycycle varchar(1)
  3879. , allowtradediscount varchar(1)
  3880. , allocatelandedcost varchar(1)
  3881. , taxclass varchar(2)
  3882. , purchasestaxclass varchar(2)
  3883. , printreceiptlabels varchar(1)
  3884. , confirmcostincrinrcptofgoods varchar(1)
  3885. , postinventorybywhse varchar(1)
  3886. , postcostofgoodssoldbywhse varchar(1)
  3887. , postsalesincomebywhse varchar(1)
  3888. , postreturnsbywhse varchar(1)
  3889. , postadjustmentbywhse varchar(1)
  3890. , postpurchasebywhse varchar(1)
  3891. , postpovariancebywhse varchar(1)
  3892. , postmfgvariancebywhse varchar(1)
  3893. , inventoryacctkey varchar(9)
  3894. , costofgoodssoldacctkey varchar(9)
  3895. , salesincomeacctkey varchar(9)
  3896. , returnsacctkey varchar(9)
  3897. , adjustmentacctkey varchar(9)
  3898. , purchaseacctkey varchar(9)
  3899. , purchaseordervarianceacctkey varchar(9)
  3900. , manufacturingvarianceacctkey varchar(9)
  3901. , warrantycode varchar(10)
  3902. , allowreturns varchar(1)
  3903. , restockingmethod varchar(1)
  3904. , scrapacctkey varchar(9)
  3905. , repairsinprocessacctkey varchar(9)
  3906. , repairsclearingacctkey varchar(9)
  3907. , postscrapbywhse varchar(1)
  3908. , postrepairsinprocessbywhse varchar(1)
  3909. , postrepairsclearingbywhse varchar(1)
  3910. , commissionrate numeric(15,4)
  3911. , basecommamt numeric(15,4)
  3912. , purchaseumconvfctr numeric(15,4)
  3913. , salesumconvfctr numeric(15,4)
  3914. , restockingcharge numeric(15,4)
  3915. , datecreated date
  3916. , timecreated varchar(8)
  3917. , usercreatedkey varchar(10)
  3918. , dateupdated date
  3919. , timeupdated varchar(8)
  3920. , userupdatedkey varchar(10)
  3921. , inactiveitem varchar(1)
  3922. , commoditycode varchar(12)
  3923. , CONSTRAINT rim_productline_KEY0_pk PRIMARY KEY (productline)
  3924. , CONSTRAINT rim_productline_KEY0_check CHECK (productline IS NOT NULL)
  3925. ) WITH (OIDS=FALSE);
  3926.  
  3927.  
  3928. CREATE TABLE sageimport.rim_salespromotion(
  3929. salespromotioncode varchar(10)
  3930. , salestartingdate date
  3931. , saleendingdate date
  3932. , salemethod varchar(1)
  3933. , saleprice numeric(15,4)
  3934. , discountpercentage numeric(15,4)
  3935. , datecreated date
  3936. , timecreated varchar(8)
  3937. , usercreatedkey varchar(10)
  3938. , dateupdated date
  3939. , timeupdated varchar(8)
  3940. , userupdatedkey varchar(10)
  3941. , CONSTRAINT rim_salespromotion_KEY0_pk PRIMARY KEY (salespromotioncode)
  3942. , CONSTRAINT rim_salespromotion_KEY0_check CHECK (salespromotioncode IS NOT NULL)
  3943. ) WITH (OIDS=FALSE);
  3944.  
  3945.  
  3946. CREATE TABLE sageimport.rim_warehouse(
  3947. warehousecode varchar(3)
  3948. , warehousedesc varchar(30)
  3949. , warehousename varchar(30)
  3950. , warehouseaddress1 varchar(30)
  3951. , warehouseaddress2 varchar(30)
  3952. , warehouseaddress3 varchar(30)
  3953. , warehousecity varchar(20)
  3954. , warehousestate varchar(2)
  3955. , warehousezipcode varchar(10)
  3956. , warehousecountrycode varchar(3)
  3957. , telephoneno varchar(17)
  3958. , telephoneext varchar(5)
  3959. , faxno varchar(17)
  3960. , emailaddress varchar(50)
  3961. , contactname varchar(30)
  3962. , posttoglsubacct varchar(15)
  3963. , datecreated date
  3964. , timecreated varchar(8)
  3965. , usercreatedkey varchar(10)
  3966. , dateupdated date
  3967. , timeupdated varchar(8)
  3968. , userupdatedkey varchar(10)
  3969. , CONSTRAINT rim_warehouse_KEY0_pk PRIMARY KEY (warehousecode)
  3970. , CONSTRAINT rim_warehouse_KEY0_check CHECK (warehousecode IS NOT NULL)
  3971. ) WITH (OIDS=FALSE);
  3972.  
  3973.  
  3974. CREATE TABLE sageimport.rpl_emailmessage(
  3975. documenttype varchar(1)
  3976. , companykey varchar(10)
  3977. , modulecode varchar(3)
  3978. , document varchar(30)
  3979. , subject varchar(150)
  3980. , emailverbiage text
  3981. , datecreated date
  3982. , timecreated varchar(8)
  3983. , usercreatedkey varchar(10)
  3984. , dateupdated date
  3985. , timeupdated varchar(8)
  3986. , userupdatedkey varchar(10)
  3987. , CONSTRAINT rpl_emailmessage_KEY0_pk PRIMARY KEY (documenttype,companykey,modulecode,document)
  3988. , CONSTRAINT rpl_emailmessage_KEY0_check CHECK (documenttype is not null and companykey is not null and modulecode is not null and document IS NOT NULL)
  3989. ) WITH (OIDS=FALSE);
  3990.  
  3991.  
  3992. CREATE TABLE sageimport.rpl_form(
  3993. companykey varchar(10)
  3994. , modulecode varchar(3)
  3995. , document varchar(30)
  3996. , enableelectronicdelivery varchar(1)
  3997. , fromemailaddress varchar(50)
  3998. , directory varchar(150)
  3999. , keeponlylastcopy varchar(1)
  4000. , overridepassword varchar(33)
  4001. , deliverduringcheckregupdatepr varchar(1)
  4002. , printstubsifnoempemailaddr varchar(1)
  4003. , defaultemployeepassword varchar(1)
  4004. , companycode varchar(3)
  4005. , datecreated date
  4006. , timecreated varchar(8)
  4007. , usercreatedkey varchar(10)
  4008. , dateupdated date
  4009. , timeupdated varchar(8)
  4010. , userupdatedkey varchar(10)
  4011. , deliverduringcheckregupdateap varchar(1)
  4012. , watermark varchar(20)
  4013. , CONSTRAINT rpl_form_KEY0_pk PRIMARY KEY (companykey,modulecode,document)
  4014. , CONSTRAINT rpl_form_KEY0_check CHECK (companykey is not null and modulecode is not null and document IS NOT NULL)
  4015. , CONSTRAINT rpl_form_KEY1_unique UNIQUE (companycode,companykey,modulecode,document)
  4016. ) WITH (OIDS=FALSE);
  4017.  
  4018.  
  4019. CREATE TABLE sageimport.rpl_journalpdflog(
  4020. companykey varchar(10)
  4021. , modulecode varchar(3)
  4022. , document varchar(60)
  4023. , sourcejournal varchar(2)
  4024. , journalno varchar(6)
  4025. , batchno varchar(5)
  4026. , accountingdate date
  4027. , sequence varchar(3)
  4028. , directory varchar(150)
  4029. , filename varchar(100)
  4030. , passwordprotected varchar(1)
  4031. , password varchar(33)
  4032. , updated varchar(1)
  4033. , associatedpdfdirectory varchar(150)
  4034. , associatedpdffilename varchar(100)
  4035. , datecreated date
  4036. , timecreated varchar(8)
  4037. , usercreatedkey varchar(10)
  4038. , CONSTRAINT rpl_journalpdflog_KEY0_pk PRIMARY KEY (companykey,modulecode,document,sourcejournal,journalno,batchno,accountingdate,sequence)
  4039. , CONSTRAINT rpl_journalpdflog_KEY0_check CHECK (companykey is not null and modulecode is not null and document is not null and sourcejournal is not null and journalno is not null and batchno is not null and accountingdate is not null and sequence IS NOT NULL)
  4040. ) WITH (OIDS=FALSE);
  4041. CREATE INDEX rpl_journalpdflog_KEY1_index ON sageimport.rpl_journalpdflog (accountingdate,companykey,modulecode,document,sourcejournal,journalno,batchno,sequence);
  4042. CREATE INDEX rpl_journalpdflog_KEY2_index ON sageimport.rpl_journalpdflog (associatedpdffilename,companykey,modulecode,document,sourcejournal,journalno,batchno,accountingdate,sequence);
  4043. CREATE INDEX rpl_journalpdflog_KEY3_index ON sageimport.rpl_journalpdflog (filename,companykey,modulecode,document,sourcejournal,journalno,batchno,accountingdate,sequence);
  4044.  
  4045.  
  4046. CREATE TABLE sageimport.rpl_journalregister(
  4047. companykey varchar(10)
  4048. , modulecode varchar(3)
  4049. , document varchar(30)
  4050. , directory varchar(150)
  4051. , autocreatepdf varchar(1)
  4052. , passwordprotect varchar(1)
  4053. , password varchar(33)
  4054. , promptforassocpdfduringprint varchar(1)
  4055. , deleteassocpdfinviewer varchar(1)
  4056. , associatedpdfdirectory varchar(150)
  4057. , companycode varchar(3)
  4058. , datecreated date
  4059. , timecreated varchar(8)
  4060. , usercreatedkey varchar(10)
  4061. , dateupdated date
  4062. , timeupdated varchar(8)
  4063. , userupdatedkey varchar(10)
  4064. , CONSTRAINT rpl_journalregister_KEY0_pk PRIMARY KEY (companykey,modulecode,document)
  4065. , CONSTRAINT rpl_journalregister_KEY0_check CHECK (companykey is not null and modulecode is not null and document IS NOT NULL)
  4066. , CONSTRAINT rpl_journalregister_KEY1_unique UNIQUE (companycode,companykey,modulecode,document)
  4067. ) WITH (OIDS=FALSE);
  4068.  
  4069.  
  4070. CREATE TABLE sageimport.rpl_options(
  4071. modulecode varchar(3)
  4072. , newsystem varchar(1)
  4073. , enableforms varchar(1)
  4074. , enablereports varchar(1)
  4075. , enablejournalsandregisters varchar(1)
  4076. , enableperiodendreports varchar(1)
  4077. , loaddataincustomerviewer varchar(1)
  4078. , loaddatainvendorviewer varchar(1)
  4079. , loaddatainreportsviewer varchar(1)
  4080. , loaddatainjrnlsandregviewer varchar(1)
  4081. , loaddatainperiodendrptsviewer varchar(1)
  4082. , loaddataindirectdepstubviewer varchar(1)
  4083. , keeponlylastpdfreports varchar(1)
  4084. , keeponlylastpdfjournalsreg varchar(1)
  4085. , keeponlylastpdfperiodendrpts varchar(1)
  4086. , dataversion numeric(15,4)
  4087. , userupdatedkey varchar(10)
  4088. , dateupdated date
  4089. , timeupdated varchar(8)
  4090. , datasublevel numeric(15,4)
  4091. , CONSTRAINT rpl_options_KEY0_pk PRIMARY KEY (modulecode)
  4092. , CONSTRAINT rpl_options_KEY0_check CHECK (modulecode IS NOT NULL)
  4093. ) WITH (OIDS=FALSE);
  4094.  
  4095.  
  4096. CREATE TABLE sageimport.rpo_cancelreasoncode(
  4097. cancelreasoncode varchar(5)
  4098. , cancelreasoncodedesc varchar(30)
  4099. , inactivecancelreasoncode varchar(1)
  4100. , datecreated date
  4101. , timecreated varchar(8)
  4102. , usercreatedkey varchar(10)
  4103. , dateupdated date
  4104. , timeupdated varchar(8)
  4105. , userupdatedkey varchar(10)
  4106. , CONSTRAINT rpo_cancelreasoncode_KEY0_pk PRIMARY KEY (cancelreasoncode)
  4107. , CONSTRAINT rpo_cancelreasoncode_KEY0_check CHECK (cancelreasoncode IS NOT NULL)
  4108. ) WITH (OIDS=FALSE);
  4109.  
  4110.  
  4111. CREATE TABLE sageimport.rpo_openorderdetailbyitem(
  4112. recordtype varchar(1)
  4113. , jobno varchar(7)
  4114. , workorderno varchar(7)
  4115. , itemcode varchar(30)
  4116. , purchaseorderno varchar(7)
  4117. , linekey varchar(6)
  4118. , CONSTRAINT rpo_openorderdetailbyitem_KEY0_pk PRIMARY KEY (recordtype,itemcode,purchaseorderno,linekey)
  4119. , CONSTRAINT rpo_openorderdetailbyitem_KEY0_check CHECK (recordtype is not null and itemcode is not null and purchaseorderno is not null and linekey IS NOT NULL)
  4120. ) WITH (OIDS=FALSE);
  4121. CREATE INDEX rpo_openorderdetailbyitem_KEY1_index ON sageimport.rpo_openorderdetailbyitem (recordtype,jobno,purchaseorderno,linekey);
  4122. CREATE INDEX rpo_openorderdetailbyitem_KEY2_index ON sageimport.rpo_openorderdetailbyitem (recordtype,workorderno,purchaseorderno,linekey);
  4123.  
  4124.  
  4125. CREATE TABLE sageimport.rpo_options(
  4126. modulecode varchar(3)
  4127. , newsystem varchar(1)
  4128. , defaultwarehousecode varchar(3)
  4129. , defaultbankcode varchar(1)
  4130. , nextpurchaseorderno varchar(7)
  4131. , nextreceiptno varchar(6)
  4132. , nextinvoiceentryno varchar(6)
  4133. , nextreturnno varchar(6)
  4134. , nextmaterialreqno varchar(6)
  4135. , currentcalendaryr varchar(4)
  4136. , currentfiscalyr varchar(4)
  4137. , currentperiod varchar(2)
  4138. , postregisterstoglindetail varchar(1)
  4139. , receiptreturncomments varchar(1)
  4140. , materialreqcomments varchar(1)
  4141. , specialitemcostacctkey varchar(9)
  4142. , payabledepacctkey varchar(9)
  4143. , prepaidfreightacctkey varchar(9)
  4144. , materialreqacctkey varchar(9)
  4145. , printreturnorders varchar(1)
  4146. , printusageinfoonautoreorderreg varchar(1)
  4147. , printbarcodereceivers varchar(1)
  4148. , printtaxjrnlsindetail varchar(1)
  4149. , printtaxdetailonregisters varchar(1)
  4150. , printordercommentsonreg varchar(1)
  4151. , postapinvoices varchar(1)
  4152. , applydiscountstofreightandtax varchar(1)
  4153. , retainreceipthistory varchar(1)
  4154. , purgeporecap varchar(1)
  4155. , daystoretaincompletedpo numeric(15,4)
  4156. , defaultfobmessage varchar(15)
  4157. , allocatefreightbyline varchar(1)
  4158. , allowqtyrecgreaterqtyord varchar(1)
  4159. , allowentryoflandedcost varchar(1)
  4160. , printlandedcostdetailonreg varchar(1)
  4161. , includeallocatedcostinunitcost varchar(1)
  4162. , autoclosepartialreceivedpos varchar(1)
  4163. , receiptvariancetoclosepolines numeric(15,4)
  4164. , integrategeneralledger varchar(1)
  4165. , integratebankrec varchar(1)
  4166. , integrateinventory varchar(1)
  4167. , integratejobcost varchar(1)
  4168. , integrateworkorder varchar(1)
  4169. , allowentryoftaxandfreight varchar(1)
  4170. , companycode varchar(3)
  4171. , yearstoretainpurchaseshist numeric(15,4)
  4172. , sortreportby varchar(1)
  4173. , onlyprintitemsreceived varchar(1)
  4174. , includeallsalesorderlines varchar(1)
  4175. , includealldropshiplineitems varchar(1)
  4176. , retaincommentlnsinreceipthist varchar(1)
  4177. , dataversion numeric(15,4)
  4178. , dateupdated date
  4179. , timeupdated varchar(8)
  4180. , userupdatedkey varchar(10)
  4181. , redisplayalldocuments varchar(1)
  4182. , redisplaypurchaseorders varchar(1)
  4183. , redisplayreturnorders varchar(1)
  4184. , retainpurchaseorderhistory varchar(1)
  4185. , retaindeletedpurchaseorders varchar(1)
  4186. , retaindeletedlines varchar(1)
  4187. , combinesalesordersbyvendor varchar(1)
  4188. , usesonoaspono varchar(1)
  4189. , applyincrementalvaltoponoat varchar(1)
  4190. , basepoheaderreqdateon varchar(1)
  4191. , basepolinereqdateon varchar(1)
  4192. , printautogeneratelistbycustno varchar(1)
  4193. , printponoassignmentlisting varchar(1)
  4194. , accesspoentryaftergeneration varchar(1)
  4195. , printpoaftergeneration varchar(1)
  4196. , enablepogenerationinsoentry varchar(1)
  4197. , prompttogeneratepo varchar(1)
  4198. , sortpolinesby varchar(1)
  4199. , includesofieldshiptoaddrdsonly varchar(1)
  4200. , includesofieldshipviadsonly varchar(1)
  4201. , includesofieldfobdsonly varchar(1)
  4202. , includesofieldconfirmto varchar(1)
  4203. , includesofieldemailaddress varchar(1)
  4204. , includesofieldcogsacctfords varchar(1)
  4205. , includesofieldaliasitemno varchar(1)
  4206. , datasublevel numeric(15,4)
  4207. , CONSTRAINT rpo_options_KEY0_pk PRIMARY KEY (modulecode)
  4208. , CONSTRAINT rpo_options_KEY0_check CHECK (modulecode IS NOT NULL)
  4209. ) WITH (OIDS=FALSE);
  4210.  
  4211.  
  4212. CREATE TABLE sageimport.rpo_purchaseorderdetail(
  4213. purchaseorderno varchar(7)
  4214. , linekey varchar(6)
  4215. , lineseqno varchar(14)
  4216. , itemcode varchar(30)
  4217. , extendeddescriptionkey varchar(10)
  4218. , itemtype varchar(1)
  4219. , itemcodedesc varchar(30)
  4220. , usetax varchar(1)
  4221. , requireddate date
  4222. , vendorpricecode varchar(4)
  4223. , purchasesacctkey varchar(9)
  4224. , valuation varchar(1)
  4225. , unitofmeasure varchar(4)
  4226. , warehousecode varchar(3)
  4227. , productline varchar(4)
  4228. , masterlinekey varchar(6)
  4229. , reschedule varchar(1)
  4230. , jobno varchar(7)
  4231. , costcode varchar(9)
  4232. , costtype varchar(1)
  4233. , receiptofgoodsupdated varchar(1)
  4234. , workorderno varchar(7)
  4235. , stepno varchar(4)
  4236. , substepprefix varchar(1)
  4237. , substepsuffix varchar(4)
  4238. , workordertype varchar(1)
  4239. , allocatelandedcost varchar(1)
  4240. , vendoraliasitemno varchar(30)
  4241. , taxclass varchar(2)
  4242. , commenttext text
  4243. , assetaccount varchar(1)
  4244. , assettemplate varchar(25)
  4245. , weightreference varchar(10)
  4246. , weight numeric(15,4)
  4247. , quantityordered numeric(15,4)
  4248. , quantityreceived numeric(15,4)
  4249. , quantitybackordered numeric(15,4)
  4250. , masteroriginalqty numeric(15,4)
  4251. , masterqtybalance numeric(15,4)
  4252. , masterqtyorderedtodate numeric(15,4)
  4253. , quantityinvoiced numeric(15,4)
  4254. , unitcost numeric(15,4)
  4255. , originalunitcost numeric(15,4)
  4256. , extensionamt numeric(15,4)
  4257. , receivedamt numeric(15,4)
  4258. , invoicedamt numeric(15,4)
  4259. , unitofmeasureconvfactor numeric(15,4)
  4260. , receivedallocatedamt numeric(15,4)
  4261. , invoicedallocatedamt numeric(15,4)
  4262. , udf_job_number varchar(15)
  4263. , udf_purchase_desc varchar(254)
  4264. , salesorderno varchar(7)
  4265. , customerpono varchar(30)
  4266. , purchaseorderhistorydtlseqno varchar(14)
  4267. , CONSTRAINT rpo_purchaseorderdetail_KEY0_pk PRIMARY KEY (purchaseorderno,linekey)
  4268. , CONSTRAINT rpo_purchaseorderdetail_KEY0_check CHECK (purchaseorderno is not null and linekey IS NOT NULL)
  4269. ) WITH (OIDS=FALSE);
  4270. CREATE INDEX rpo_purchaseorderdetail_KEY1_index ON sageimport.rpo_purchaseorderdetail (purchaseorderno,lineseqno,linekey);
  4271. CREATE INDEX rpo_purchaseorderdetail_KEY2_index ON sageimport.rpo_purchaseorderdetail (extendeddescriptionkey,purchaseorderno,linekey);
  4272. CREATE INDEX rpo_purchaseorderdetail_KEY3_index ON sageimport.rpo_purchaseorderdetail (itemtype,itemcode,purchaseorderno,linekey);
  4273. CREATE INDEX rpo_purchaseorderdetail_KEY4_index ON sageimport.rpo_purchaseorderdetail (itemcode,warehousecode,purchaseorderno,linekey);
  4274.  
  4275.  
  4276. CREATE TABLE sageimport.rpo_purchaseorderheader(
  4277. purchaseorderno varchar(7)
  4278. , purchaseorderdate date
  4279. , ordertype varchar(1)
  4280. , masterrepeatingorderno varchar(7)
  4281. , requiredexpiredate date
  4282. , apdivisionno varchar(2)
  4283. , vendorno varchar(7)
  4284. , purchasename varchar(50)
  4285. , purchaseaddress1 varchar(30)
  4286. , purchaseaddress2 varchar(30)
  4287. , purchaseaddress3 varchar(30)
  4288. , purchasecity varchar(20)
  4289. , purchasestate varchar(2)
  4290. , purchasezipcode varchar(10)
  4291. , purchasecountrycode varchar(3)
  4292. , purchaseaddresscode varchar(4)
  4293. , shiptocode varchar(4)
  4294. , shiptoname varchar(50)
  4295. , shiptoaddress1 varchar(30)
  4296. , shiptoaddress2 varchar(30)
  4297. , shiptoaddress3 varchar(30)
  4298. , shiptocity varchar(20)
  4299. , shiptostate varchar(2)
  4300. , shiptozipcode varchar(10)
  4301. , shiptocountrycode varchar(3)
  4302. , orderstatus varchar(1)
  4303. , usetax varchar(1)
  4304. , printpurchaseorders varchar(1)
  4305. , onhold varchar(1)
  4306. , batchfax varchar(1)
  4307. , batchemail varchar(1)
  4308. , emailaddress varchar(250)
  4309. , completiondate date
  4310. , shipvia varchar(15)
  4311. , fob varchar(15)
  4312. , warehousecode varchar(3)
  4313. , confirmto varchar(30)
  4314. , comment varchar(30)
  4315. , ardivisionno varchar(2)
  4316. , customerno varchar(20)
  4317. , termscode varchar(2)
  4318. , lastinvoicedate date
  4319. , lastinvoiceno varchar(20)
  4320. , form1099 varchar(1)
  4321. , box1099 varchar(3)
  4322. , lastreceiptdate date
  4323. , lastissuedate date
  4324. , lastpurchaseorderdate date
  4325. , lastreceiptno varchar(7)
  4326. , lastissueno varchar(7)
  4327. , lastpurchaseorderno varchar(7)
  4328. , prepaidcheckno varchar(10)
  4329. , faxno varchar(17)
  4330. , taxschedule varchar(9)
  4331. , invalidtaxcalc varchar(1)
  4332. , salesorderno varchar(7)
  4333. , requisitorname varchar(30)
  4334. , requisitordepartment varchar(30)
  4335. , prepaidamt numeric(15,4)
  4336. , taxableamt numeric(15,4)
  4337. , nontaxableamt numeric(15,4)
  4338. , salestaxamt numeric(15,4)
  4339. , freightamt numeric(15,4)
  4340. , prepaidfreightamt numeric(15,4)
  4341. , invoicedamt numeric(15,4)
  4342. , receivedamt numeric(15,4)
  4343. , freightsalestaxinvamt numeric(15,4)
  4344. , backorderlostamt numeric(15,4)
  4345. , datecreated date
  4346. , timecreated varchar(8)
  4347. , usercreatedkey varchar(10)
  4348. , dateupdated date
  4349. , timeupdated varchar(8)
  4350. , userupdatedkey varchar(10)
  4351. , udf_special_info varchar(50)
  4352. , CONSTRAINT rpo_purchaseorderheader_KEY0_pk PRIMARY KEY (purchaseorderno)
  4353. , CONSTRAINT rpo_purchaseorderheader_KEY0_check CHECK (purchaseorderno IS NOT NULL)
  4354. ) WITH (OIDS=FALSE);
  4355. CREATE INDEX rpo_purchaseorderheader_KEY1_index ON sageimport.rpo_purchaseorderheader (apdivisionno,vendorno,purchaseorderno);
  4356.  
  4357.  
  4358. CREATE TABLE sageimport.rpo_purchaseorderhistorydetail(
  4359. purchaseorderno varchar(7)
  4360. , sequenceno varchar(14)
  4361. , linekey varchar(6)
  4362. , originalline varchar(1)
  4363. , cancelledline varchar(1)
  4364. , cancelreasoncode varchar(5)
  4365. , itemcode varchar(30)
  4366. , extendeddescriptionkey varchar(10)
  4367. , itemtype varchar(1)
  4368. , itemcodedesc varchar(30)
  4369. , usetax varchar(1)
  4370. , requireddate date
  4371. , vendorpricecode varchar(4)
  4372. , purchasesacctkey varchar(9)
  4373. , unitofmeasure varchar(4)
  4374. , warehousecode varchar(3)
  4375. , productline varchar(4)
  4376. , masterlinekey varchar(6)
  4377. , reschedule varchar(1)
  4378. , jobno varchar(7)
  4379. , costcode varchar(9)
  4380. , costtype varchar(1)
  4381. , workorderno varchar(7)
  4382. , stepno varchar(4)
  4383. , substepprefix varchar(1)
  4384. , substepsuffix varchar(4)
  4385. , workordertype varchar(1)
  4386. , allocatelandedcost varchar(1)
  4387. , vendoraliasitemno varchar(30)
  4388. , taxclass varchar(2)
  4389. , commenttext text
  4390. , assetaccount varchar(1)
  4391. , assettemplate varchar(25)
  4392. , weightreference varchar(10)
  4393. , salesorderno varchar(7)
  4394. , customerpono varchar(30)
  4395. , weight numeric(15,4)
  4396. , quantityorderedoriginal numeric(15,4)
  4397. , quantityorderedrevised numeric(15,4)
  4398. , quantityreceived numeric(15,4)
  4399. , quantitybackordered numeric(15,4)
  4400. , quantityinvoiced numeric(15,4)
  4401. , originalunitcost numeric(15,4)
  4402. , lastunitcost numeric(15,4)
  4403. , lastextensionamt numeric(15,4)
  4404. , receivedamt numeric(15,4)
  4405. , invoicedamt numeric(15,4)
  4406. , unitofmeasureconvfactor numeric(15,4)
  4407. , receivedallocatedamt numeric(15,4)
  4408. , invoicedallocatedamt numeric(15,4)
  4409. , udf_job_number varchar(15)
  4410. , udf_purchase_desc varchar(254)
  4411. , CONSTRAINT rpo_purchaseorderhistorydetail_KEY0_pk PRIMARY KEY (purchaseorderno,sequenceno)
  4412. , CONSTRAINT rpo_purchaseorderhistorydetail_KEY0_check CHECK (purchaseorderno is not null and sequenceno IS NOT NULL)
  4413. ) WITH (OIDS=FALSE);
  4414. CREATE INDEX rpo_purchaseorderhistorydetail_KEY1_index ON sageimport.rpo_purchaseorderhistorydetail (purchaseorderno,sequenceno,linekey);
  4415. CREATE INDEX rpo_purchaseorderhistorydetail_KEY2_index ON sageimport.rpo_purchaseorderhistorydetail (extendeddescriptionkey,purchaseorderno,sequenceno);
  4416. CREATE INDEX rpo_purchaseorderhistorydetail_KEY3_index ON sageimport.rpo_purchaseorderhistorydetail (cancelledline,cancelreasoncode,purchaseorderno,sequenceno);
  4417.  
  4418.  
  4419. CREATE TABLE sageimport.rpo_purchaseorderhistoryheader(
  4420. purchaseorderno varchar(7)
  4421. , purchaseorderdate date
  4422. , ordertype varchar(1)
  4423. , masterrepeatingorderno varchar(7)
  4424. , requiredexpiredate date
  4425. , apdivisionno varchar(2)
  4426. , vendorno varchar(7)
  4427. , purchasename varchar(50)
  4428. , purchaseaddress1 varchar(30)
  4429. , purchaseaddress2 varchar(30)
  4430. , purchaseaddress3 varchar(30)
  4431. , purchasecity varchar(20)
  4432. , purchasestate varchar(2)
  4433. , purchasezipcode varchar(10)
  4434. , purchasecountrycode varchar(3)
  4435. , purchaseaddresscode varchar(4)
  4436. , shiptocode varchar(4)
  4437. , shiptoname varchar(50)
  4438. , shiptoaddress1 varchar(30)
  4439. , shiptoaddress2 varchar(30)
  4440. , shiptoaddress3 varchar(30)
  4441. , shiptocity varchar(20)
  4442. , shiptostate varchar(2)
  4443. , shiptozipcode varchar(10)
  4444. , shiptocountrycode varchar(3)
  4445. , orderstatus varchar(1)
  4446. , usetax varchar(1)
  4447. , onhold varchar(1)
  4448. , emailaddress varchar(250)
  4449. , completiondate date
  4450. , shipvia varchar(15)
  4451. , fob varchar(15)
  4452. , warehousecode varchar(3)
  4453. , confirmto varchar(30)
  4454. , comment varchar(30)
  4455. , ardivisionno varchar(2)
  4456. , customerno varchar(20)
  4457. , termscode varchar(2)
  4458. , lastinvoicedate date
  4459. , lastinvoiceno varchar(20)
  4460. , form1099 varchar(1)
  4461. , box1099 varchar(3)
  4462. , cancelreasoncode varchar(5)
  4463. , lastreceiptdate date
  4464. , lastissuedate date
  4465. , lastreceiptno varchar(7)
  4466. , lastissueno varchar(7)
  4467. , prepaidcheckno varchar(10)
  4468. , faxno varchar(17)
  4469. , taxschedule varchar(9)
  4470. , salesorderno varchar(7)
  4471. , requisitorname varchar(30)
  4472. , requisitordepartment varchar(30)
  4473. , prepaidamt numeric(15,4)
  4474. , taxableamt numeric(15,4)
  4475. , nontaxableamt numeric(15,4)
  4476. , salestaxamt numeric(15,4)
  4477. , freightamt numeric(15,4)
  4478. , prepaidfreightamt numeric(15,4)
  4479. , invoicedamt numeric(15,4)
  4480. , receivedamt numeric(15,4)
  4481. , freightsalestaxinvamt numeric(15,4)
  4482. , backorderlostamt numeric(15,4)
  4483. , datecreated date
  4484. , timecreated varchar(8)
  4485. , usercreatedkey varchar(10)
  4486. , dateupdated date
  4487. , timeupdated varchar(8)
  4488. , userupdatedkey varchar(10)
  4489. , udf_special_info varchar(50)
  4490. , CONSTRAINT rpo_purchaseorderhistoryheader_KEY0_pk PRIMARY KEY (purchaseorderno)
  4491. , CONSTRAINT rpo_purchaseorderhistoryheader_KEY0_check CHECK (purchaseorderno IS NOT NULL)
  4492. ) WITH (OIDS=FALSE);
  4493. CREATE INDEX rpo_purchaseorderhistoryheader_KEY1_index ON sageimport.rpo_purchaseorderhistoryheader (apdivisionno,vendorno,purchaseorderno);
  4494. CREATE INDEX rpo_purchaseorderhistoryheader_KEY2_index ON sageimport.rpo_purchaseorderhistoryheader (purchasename,purchaseorderno);
  4495. CREATE INDEX rpo_purchaseorderhistoryheader_KEY3_index ON sageimport.rpo_purchaseorderhistoryheader (purchaseorderdate,purchaseorderno);
  4496. CREATE INDEX rpo_purchaseorderhistoryheader_KEY4_index ON sageimport.rpo_purchaseorderhistoryheader (orderstatus,cancelreasoncode,purchaseorderno);
  4497.  
  4498.  
  4499. CREATE TABLE sageimport.rpo_purchaseorderhisttaxdetail(
  4500. purchaseorderno varchar(7)
  4501. , scheduleseqno varchar(6)
  4502. , taxcode varchar(15)
  4503. , taxclass varchar(2)
  4504. , purchasestaxable varchar(1)
  4505. , taxablepurchasesamt numeric(15,4)
  4506. , nontaxablepurchasesamt numeric(15,4)
  4507. , exemptpurchasesamt numeric(15,4)
  4508. , usetaxablepurchasesamt numeric(15,4)
  4509. , taxrate numeric(15,4)
  4510. , nonrecoverablepercent numeric(15,4)
  4511. , dateupdated date
  4512. , timeupdated varchar(8)
  4513. , userupdatedkey varchar(10)
  4514. , CONSTRAINT rpo_purchaseorderhisttaxdetail_KEY0_pk PRIMARY KEY (purchaseorderno,scheduleseqno,taxcode,taxclass)
  4515. , CONSTRAINT rpo_purchaseorderhisttaxdetail_KEY0_check CHECK (purchaseorderno is not null and scheduleseqno is not null and taxcode is not null and taxclass IS NOT NULL)
  4516. ) WITH (OIDS=FALSE);
  4517.  
  4518.  
  4519. CREATE TABLE sageimport.rpo_purchaseorderhisttaxsummary(
  4520. purchaseorderno varchar(7)
  4521. , scheduleseqno varchar(6)
  4522. , taxcode varchar(15)
  4523. , exemptionno varchar(20)
  4524. , overridden varchar(1)
  4525. , expensetovendoritem varchar(1)
  4526. , useexemptionsonfile varchar(1)
  4527. , taxablepurchasesamt numeric(15,4)
  4528. , taxablefreightamt numeric(15,4)
  4529. , taxabletaxamt numeric(15,4)
  4530. , nontaxablepurchasesamt numeric(15,4)
  4531. , nontaxablefreightamt numeric(15,4)
  4532. , exemptpurchasesamt numeric(15,4)
  4533. , usetaxamt numeric(15,4)
  4534. , nonrecoverableamt numeric(15,4)
  4535. , taxamt numeric(15,4)
  4536. , dateupdated date
  4537. , timeupdated varchar(8)
  4538. , userupdatedkey varchar(10)
  4539. , CONSTRAINT rpo_purchaseorderhisttaxsummary_KEY0_pk PRIMARY KEY (purchaseorderno,scheduleseqno,taxcode)
  4540. , CONSTRAINT rpo_purchaseorderhisttaxsummary_KEY0_check CHECK (purchaseorderno is not null and scheduleseqno is not null and taxcode IS NOT NULL)
  4541. ) WITH (OIDS=FALSE);
  4542.  
  4543.  
  4544. CREATE TABLE sageimport.rpo_purchaseorderprint(
  4545. printtype varchar(1)
  4546. , purchaseorderno varchar(7)
  4547. , CONSTRAINT rpo_purchaseorderprint_KEY0_pk PRIMARY KEY (purchaseorderno)
  4548. , CONSTRAINT rpo_purchaseorderprint_KEY0_check CHECK (purchaseorderno IS NOT NULL)
  4549. ) WITH (OIDS=FALSE);
  4550.  
  4551.  
  4552. CREATE TABLE sageimport.rpo_purchaseorderrecap(
  4553. purchaseorderno varchar(7)
  4554. , purchaseorderdate date
  4555. , ordertype varchar(1)
  4556. , apdivisionno varchar(2)
  4557. , vendorno varchar(7)
  4558. , vendorname varchar(50)
  4559. , orderstatus varchar(1)
  4560. , requiredexpiredate date
  4561. , comment varchar(30)
  4562. , lastinvoicedate date
  4563. , lastinvoiceno varchar(20)
  4564. , lastreceiptdate date
  4565. , lastpurchaseorderdate date
  4566. , lastreceiptno varchar(7)
  4567. , lastpurchaseorderno varchar(7)
  4568. , ordertotal numeric(15,4)
  4569. , dateupdated date
  4570. , timeupdated varchar(8)
  4571. , userupdatedkey varchar(10)
  4572. , CONSTRAINT rpo_purchaseorderrecap_KEY0_pk PRIMARY KEY (purchaseorderno)
  4573. , CONSTRAINT rpo_purchaseorderrecap_KEY0_check CHECK (purchaseorderno IS NOT NULL)
  4574. ) WITH (OIDS=FALSE);
  4575.  
  4576.  
  4577. CREATE TABLE sageimport.rpo_purchaseordertaxdetail(
  4578. purchaseorderno varchar(7)
  4579. , scheduleseqno varchar(6)
  4580. , taxcode varchar(15)
  4581. , taxclass varchar(2)
  4582. , purchasestaxable varchar(1)
  4583. , taxablepurchasesamt numeric(15,4)
  4584. , nontaxablepurchasesamt numeric(15,4)
  4585. , exemptpurchasesamt numeric(15,4)
  4586. , usetaxablepurchasesamt numeric(15,4)
  4587. , taxrate numeric(15,4)
  4588. , nonrecoverablepercent numeric(15,4)
  4589. , CONSTRAINT rpo_purchaseordertaxdetail_KEY0_pk PRIMARY KEY (purchaseorderno,scheduleseqno,taxcode,taxclass)
  4590. , CONSTRAINT rpo_purchaseordertaxdetail_KEY0_check CHECK (purchaseorderno is not null and scheduleseqno is not null and taxcode is not null and taxclass IS NOT NULL)
  4591. ) WITH (OIDS=FALSE);
  4592.  
  4593.  
  4594. CREATE TABLE sageimport.rpo_purchaseordertaxsummary(
  4595. purchaseorderno varchar(7)
  4596. , scheduleseqno varchar(6)
  4597. , taxcode varchar(15)
  4598. , exemptionno varchar(20)
  4599. , overridden varchar(1)
  4600. , expensetovendoritem varchar(1)
  4601. , useexemptionsonfile varchar(1)
  4602. , taxablepurchasesamt numeric(15,4)
  4603. , taxablefreightamt numeric(15,4)
  4604. , taxabletaxamt numeric(15,4)
  4605. , nontaxablepurchasesamt numeric(15,4)
  4606. , nontaxablefreightamt numeric(15,4)
  4607. , exemptpurchasesamt numeric(15,4)
  4608. , usetaxamt numeric(15,4)
  4609. , nonrecoverableamt numeric(15,4)
  4610. , taxamt numeric(15,4)
  4611. , CONSTRAINT rpo_purchaseordertaxsummary_KEY0_pk PRIMARY KEY (purchaseorderno,scheduleseqno,taxcode)
  4612. , CONSTRAINT rpo_purchaseordertaxsummary_KEY0_check CHECK (purchaseorderno is not null and scheduleseqno is not null and taxcode IS NOT NULL)
  4613. ) WITH (OIDS=FALSE);
  4614.  
  4615.  
  4616. CREATE TABLE sageimport.rpo_purchaseshistory(
  4617. apdivisionno varchar(2)
  4618. , vendorno varchar(7)
  4619. , itemcode varchar(30)
  4620. , itemtype varchar(1)
  4621. , productline varchar(4)
  4622. , warehousecode varchar(3)
  4623. , dropship varchar(1)
  4624. , postingdate date
  4625. , receiptdate date
  4626. , purchaseorderdate date
  4627. , itemcodedesc varchar(30)
  4628. , vendorname varchar(50)
  4629. , quantitypurchased numeric(15,4)
  4630. , dollarspurchased numeric(15,4)
  4631. , dateupdated date
  4632. , timeupdated varchar(8)
  4633. , userupdatedkey varchar(10)
  4634. , CONSTRAINT rpo_purchaseshistory_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,itemcode,itemtype,productline,warehousecode,dropship,postingdate,receiptdate)
  4635. , CONSTRAINT rpo_purchaseshistory_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and itemcode is not null and itemtype is not null and productline is not null and warehousecode is not null and dropship is not null and postingdate is not null and receiptdate IS NOT NULL)
  4636. ) WITH (OIDS=FALSE);
  4637. CREATE INDEX rpo_purchaseshistory_KEY1_index ON sageimport.rpo_purchaseshistory (dropship,itemcode,apdivisionno,vendorno,warehousecode,postingdate,receiptdate);
  4638. CREATE INDEX rpo_purchaseshistory_KEY2_index ON sageimport.rpo_purchaseshistory (itemcode,apdivisionno,vendorno,warehousecode,postingdate,itemtype,productline,dropship,receiptdate);
  4639. CREATE INDEX rpo_purchaseshistory_KEY3_index ON sageimport.rpo_purchaseshistory (vendorname,apdivisionno,vendorno,itemcode,warehousecode,postingdate,itemtype,productline,dropship,receiptdate);
  4640. CREATE INDEX rpo_purchaseshistory_KEY4_index ON sageimport.rpo_purchaseshistory (warehousecode,itemcode,apdivisionno,vendorno,postingdate,itemtype,productline,dropship,receiptdate);
  4641.  
  4642.  
  4643. CREATE TABLE sageimport.rpo_receipthistorydetail(
  4644. purchaseorderno varchar(7)
  4645. , receipttype varchar(1)
  4646. , receiptno varchar(6)
  4647. , headerseqno varchar(6)
  4648. , itemcode varchar(30)
  4649. , linekey varchar(6)
  4650. , itemtype varchar(1)
  4651. , lineseqno varchar(14)
  4652. , itemcodedesc varchar(30)
  4653. , extendeddescriptionkey varchar(10)
  4654. , warehousecode varchar(3)
  4655. , unitofmeasure varchar(4)
  4656. , allocatelandedcost varchar(1)
  4657. , usetax varchar(1)
  4658. , jobno varchar(7)
  4659. , costcode varchar(9)
  4660. , costtype varchar(1)
  4661. , workorderno varchar(7)
  4662. , stepno varchar(4)
  4663. , substepprefix varchar(1)
  4664. , substepsuffix varchar(4)
  4665. , workordertype varchar(1)
  4666. , valuation varchar(1)
  4667. , expenseacctkey varchar(9)
  4668. , requireddate date
  4669. , taxclass varchar(2)
  4670. , vendorpricecode varchar(4)
  4671. , orderwarehousecode varchar(3)
  4672. , productline varchar(4)
  4673. , vendoraliasitemno varchar(30)
  4674. , commenttext text
  4675. , weightreference varchar(10)
  4676. , weight numeric(15,4)
  4677. , quantityreceived numeric(15,4)
  4678. , extensionamt numeric(15,4)
  4679. , unitcost numeric(15,4)
  4680. , originalunitcost numeric(15,4)
  4681. , originalquantityordered numeric(15,4)
  4682. , previousquantityreceived numeric(15,4)
  4683. , previousquantityinvoiced numeric(15,4)
  4684. , unitofmeasureconvfactor numeric(15,4)
  4685. , salesorderno varchar(7)
  4686. , customerpono varchar(30)
  4687. , allocatedfreightamt numeric(15,4)
  4688. , allocatedlandedcostamt numeric(15,4)
  4689. , allocatedtaxamt numeric(15,4)
  4690. , CONSTRAINT rpo_receipthistorydetail_KEY0_pk PRIMARY KEY (purchaseorderno,receipttype,receiptno,headerseqno,itemtype,itemcode,linekey)
  4691. , CONSTRAINT rpo_receipthistorydetail_KEY0_check CHECK (purchaseorderno is not null and receipttype is not null and receiptno is not null and headerseqno is not null and itemtype is not null and itemcode is not null and linekey IS NOT NULL)
  4692. ) WITH (OIDS=FALSE);
  4693. CREATE INDEX rpo_receipthistorydetail_KEY1_index ON sageimport.rpo_receipthistorydetail (purchaseorderno,receipttype,receiptno,headerseqno,lineseqno,linekey,itemtype,itemcode);
  4694. CREATE INDEX rpo_receipthistorydetail_KEY2_index ON sageimport.rpo_receipthistorydetail (extendeddescriptionkey,purchaseorderno,receipttype,receiptno,headerseqno,itemtype,itemcode,linekey);
  4695.  
  4696.  
  4697. CREATE TABLE sageimport.rpo_receipthistoryheader(
  4698. purchaseorderno varchar(7)
  4699. , receipttype varchar(1)
  4700. , receiptno varchar(6)
  4701. , headerseqno varchar(6)
  4702. , receiptdate date
  4703. , apdivisionno varchar(2)
  4704. , vendorno varchar(7)
  4705. , purchasename varchar(50)
  4706. , purchaseaddress1 varchar(30)
  4707. , purchaseaddress2 varchar(30)
  4708. , purchaseaddress3 varchar(30)
  4709. , purchasecity varchar(20)
  4710. , purchasestate varchar(2)
  4711. , purchasezipcode varchar(10)
  4712. , purchasecountrycode varchar(3)
  4713. , purchaseaddresscode varchar(4)
  4714. , shiptocode varchar(4)
  4715. , shiptoname varchar(50)
  4716. , shiptoaddress1 varchar(30)
  4717. , shiptoaddress2 varchar(30)
  4718. , shiptoaddress3 varchar(30)
  4719. , shiptocity varchar(20)
  4720. , shiptostate varchar(2)
  4721. , shiptozipcode varchar(10)
  4722. , shiptocountrycode varchar(3)
  4723. , emailaddress varchar(250)
  4724. , ordertype varchar(1)
  4725. , orderdate date
  4726. , requireddate date
  4727. , usetax varchar(1)
  4728. , shipvia varchar(15)
  4729. , fob varchar(15)
  4730. , warehousecode varchar(3)
  4731. , confirmto varchar(30)
  4732. , comment varchar(30)
  4733. , ardivisionno varchar(2)
  4734. , customerno varchar(20)
  4735. , termscode varchar(2)
  4736. , invoicedate date
  4737. , invoiceno varchar(20)
  4738. , lastreceiptdate date
  4739. , lastreceiptno varchar(7)
  4740. , prepaidcheckno varchar(10)
  4741. , invoiceduedate date
  4742. , discountduedate date
  4743. , holdpayment varchar(1)
  4744. , codno varchar(10)
  4745. , codcheckno varchar(10)
  4746. , bankcode varchar(1)
  4747. , sourcejournal varchar(2)
  4748. , sourcejournalbatchno varchar(6)
  4749. , transactiondate date
  4750. , taxschedule varchar(9)
  4751. , returnauthorizationno varchar(15)
  4752. , receiptamt numeric(15,4)
  4753. , invoiceamt numeric(15,4)
  4754. , prepaidamt numeric(15,4)
  4755. , taxableamt numeric(15,4)
  4756. , nontaxableamt numeric(15,4)
  4757. , salestaxamt numeric(15,4)
  4758. , freightamt numeric(15,4)
  4759. , prepaidfreightamt numeric(15,4)
  4760. , discountamt numeric(15,4)
  4761. , taxablemiscchrgamt numeric(15,4)
  4762. , codamt numeric(15,4)
  4763. , dateupdated date
  4764. , timeupdated varchar(8)
  4765. , userupdatedkey varchar(10)
  4766. , datecreated date
  4767. , timecreated varchar(8)
  4768. , usercreatedkey varchar(10)
  4769. , CONSTRAINT rpo_receipthistoryheader_KEY0_pk PRIMARY KEY (purchaseorderno,receipttype,receiptno,headerseqno)
  4770. , CONSTRAINT rpo_receipthistoryheader_KEY0_check CHECK (purchaseorderno is not null and receipttype is not null and receiptno is not null and headerseqno IS NOT NULL)
  4771. ) WITH (OIDS=FALSE);
  4772. CREATE INDEX rpo_receipthistoryheader_KEY1_index ON sageimport.rpo_receipthistoryheader (apdivisionno,vendorno,purchaseorderno,receipttype,receiptno,headerseqno);
  4773. CREATE INDEX rpo_receipthistoryheader_KEY2_index ON sageimport.rpo_receipthistoryheader (purchasename,purchaseorderno,receipttype,receiptno,headerseqno);
  4774. CREATE INDEX rpo_receipthistoryheader_KEY3_index ON sageimport.rpo_receipthistoryheader (receipttype,receiptno,headerseqno,purchaseorderno);
  4775.  
  4776.  
  4777. CREATE TABLE sageimport.rpo_receipthistorytaxsummary(
  4778. purchaseorderno varchar(7)
  4779. , receipttype varchar(1)
  4780. , receiptno varchar(6)
  4781. , headerseqno varchar(6)
  4782. , scheduleseqno varchar(6)
  4783. , taxcode varchar(15)
  4784. , exemptionno varchar(20)
  4785. , overridden varchar(1)
  4786. , expensetovendoritem varchar(1)
  4787. , useexemptionsonfile varchar(1)
  4788. , taxablepurchasesamt numeric(15,4)
  4789. , taxablefreightamt numeric(15,4)
  4790. , taxabletaxamt numeric(15,4)
  4791. , nontaxablepurchasesamt numeric(15,4)
  4792. , nontaxablefreightamt numeric(15,4)
  4793. , exemptpurchasesamt numeric(15,4)
  4794. , usetaxamt numeric(15,4)
  4795. , nonrecoverableamt numeric(15,4)
  4796. , taxamt numeric(15,4)
  4797. , allocatedtaxamt numeric(15,4)
  4798. , CONSTRAINT rpo_receipthistorytaxsummary_KEY0_pk PRIMARY KEY (purchaseorderno,receipttype,receiptno,headerseqno,scheduleseqno,taxcode)
  4799. , CONSTRAINT rpo_receipthistorytaxsummary_KEY0_check CHECK (purchaseorderno is not null and receipttype is not null and receiptno is not null and headerseqno is not null and scheduleseqno is not null and taxcode IS NOT NULL)
  4800. ) WITH (OIDS=FALSE);
  4801.  
  4802.  
  4803. CREATE TABLE sageimport.rpo_shiptoaddress(
  4804. shiptocode varchar(4)
  4805. , shiptocodedesc varchar(30)
  4806. , shiptoname varchar(50)
  4807. , shiptoaddress1 varchar(30)
  4808. , shiptoaddress2 varchar(30)
  4809. , shiptoaddress3 varchar(30)
  4810. , shiptocity varchar(20)
  4811. , shiptostate varchar(2)
  4812. , shiptozipcode varchar(10)
  4813. , shiptocountrycode varchar(3)
  4814. , telephoneno varchar(17)
  4815. , telephoneext varchar(5)
  4816. , faxno varchar(17)
  4817. , emailaddress varchar(50)
  4818. , contactname varchar(30)
  4819. , datecreated date
  4820. , timecreated varchar(8)
  4821. , usercreatedkey varchar(10)
  4822. , dateupdated date
  4823. , timeupdated varchar(8)
  4824. , userupdatedkey varchar(10)
  4825. , warehousecode varchar(3)
  4826. , CONSTRAINT rpo_shiptoaddress_KEY0_pk PRIMARY KEY (shiptocode)
  4827. , CONSTRAINT rpo_shiptoaddress_KEY0_check CHECK (shiptocode IS NOT NULL)
  4828. ) WITH (OIDS=FALSE);
  4829.  
  4830.  
  4831. CREATE TABLE sageimport.rpo_vendorpricelevel(
  4832. apdivisionno varchar(2)
  4833. , vendorno varchar(7)
  4834. , pricingtype varchar(1)
  4835. , productline varchar(4)
  4836. , itemcode varchar(30)
  4837. , pricingmethod varchar(1)
  4838. , breakquantity1 numeric(15,4)
  4839. , breakquantity2 numeric(15,4)
  4840. , breakquantity3 numeric(15,4)
  4841. , breakquantity4 numeric(15,4)
  4842. , breakquantity5 numeric(15,4)
  4843. , breakquantity6 numeric(15,4)
  4844. , breakquantity7 numeric(15,4)
  4845. , breakquantity8 numeric(15,4)
  4846. , discountmarkup1 numeric(15,4)
  4847. , discountmarkup2 numeric(15,4)
  4848. , discountmarkup3 numeric(15,4)
  4849. , discountmarkup4 numeric(15,4)
  4850. , discountmarkup5 numeric(15,4)
  4851. , discountmarkup6 numeric(15,4)
  4852. , discountmarkup7 numeric(15,4)
  4853. , discountmarkup8 numeric(15,4)
  4854. , datecreated date
  4855. , timecreated varchar(8)
  4856. , usercreatedkey varchar(10)
  4857. , dateupdated date
  4858. , timeupdated varchar(8)
  4859. , userupdatedkey varchar(10)
  4860. , CONSTRAINT rpo_vendorpricelevel_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,pricingtype,productline,itemcode)
  4861. , CONSTRAINT rpo_vendorpricelevel_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and pricingtype is not null and productline is not null and itemcode IS NOT NULL)
  4862. ) WITH (OIDS=FALSE);
  4863. CREATE INDEX rpo_vendorpricelevel_KEY1_index ON sageimport.rpo_vendorpricelevel (apdivisionno,vendorno,pricingtype,productline,itemcode);
  4864.  
  4865.  
  4866. CREATE TABLE sageimport.rpo_vendorpurchaseaddress(
  4867. apdivisionno varchar(2)
  4868. , vendorno varchar(7)
  4869. , purchaseaddresscode varchar(4)
  4870. , purchasename varchar(50)
  4871. , purchaseaddress1 varchar(30)
  4872. , purchaseaddress2 varchar(30)
  4873. , purchaseaddress3 varchar(30)
  4874. , purchasecity varchar(20)
  4875. , purchasestate varchar(2)
  4876. , purchasezipcode varchar(10)
  4877. , purchasecountrycode varchar(3)
  4878. , batchfax varchar(1)
  4879. , telephoneno varchar(17)
  4880. , telephoneext varchar(5)
  4881. , faxno varchar(17)
  4882. , contactcode varchar(10)
  4883. , taxschedule varchar(9)
  4884. , exemptionnoonfile varchar(1)
  4885. , emailaddress varchar(50)
  4886. , datecreated date
  4887. , timecreated varchar(8)
  4888. , usercreatedkey varchar(10)
  4889. , dateupdated date
  4890. , timeupdated varchar(8)
  4891. , userupdatedkey varchar(10)
  4892. , CONSTRAINT rpo_vendorpurchaseaddress_KEY0_pk PRIMARY KEY (apdivisionno,vendorno,purchaseaddresscode)
  4893. , CONSTRAINT rpo_vendorpurchaseaddress_KEY0_check CHECK (apdivisionno is not null and vendorno is not null and purchaseaddresscode IS NOT NULL)
  4894. ) WITH (OIDS=FALSE);
  4895.  
  4896.  
  4897. CREATE TABLE sageimport.rpr_acaofferofcoverage(
  4898. offerofcoveragecode varchar(2)
  4899. , description text
  4900. , CONSTRAINT rpr_acaofferofcoverage_KEY0_pk PRIMARY KEY (offerofcoveragecode)
  4901. , CONSTRAINT rpr_acaofferofcoverage_KEY0_check CHECK (offerofcoveragecode IS NOT NULL)
  4902. ) WITH (OIDS=FALSE);
  4903.  
  4904.  
  4905. CREATE TABLE sageimport.rpr_acapolicyorigin(
  4906. policyorigincode varchar(1)
  4907. , policyorigincodedesc text
  4908. , CONSTRAINT rpr_acapolicyorigin_KEY0_pk PRIMARY KEY (policyorigincode)
  4909. , CONSTRAINT rpr_acapolicyorigin_KEY0_check CHECK (policyorigincode IS NOT NULL)
  4910. ) WITH (OIDS=FALSE);
  4911.  
  4912.  
  4913. CREATE TABLE sageimport.rpr_acasafeharbor(
  4914. safeharborcode varchar(2)
  4915. , description varchar(200)
  4916. , CONSTRAINT rpr_acasafeharbor_KEY0_pk PRIMARY KEY (safeharborcode)
  4917. , CONSTRAINT rpr_acasafeharbor_KEY0_check CHECK (safeharborcode IS NOT NULL)
  4918. ) WITH (OIDS=FALSE);
  4919.  
  4920.  
  4921. CREATE TABLE sageimport.rpr_acatransitionrelief(
  4922. transitionreliefindicator varchar(1)
  4923. , description varchar(200)
  4924. , CONSTRAINT rpr_acatransitionrelief_KEY0_pk PRIMARY KEY (transitionreliefindicator)
  4925. , CONSTRAINT rpr_acatransitionrelief_KEY0_check CHECK (transitionreliefindicator IS NOT NULL)
  4926. ) WITH (OIDS=FALSE);
  4927.  
  4928.  
  4929. CREATE TABLE sageimport.rra_customerinvoicesearch(
  4930. ardivisionno varchar(2)
  4931. , customerno varchar(20)
  4932. , itemcode varchar(30)
  4933. , itemtype varchar(1)
  4934. , itemcodedesc varchar(30)
  4935. , invoiceno varchar(7)
  4936. , headerseqno varchar(6)
  4937. , detailseqno varchar(6)
  4938. , modulecode varchar(3)
  4939. , invoicedate date
  4940. , shipdate date
  4941. , unitofmeasure varchar(4)
  4942. , salesorderno varchar(7)
  4943. , customerpono varchar(30)
  4944. , quantityshipped numeric(15,4)
  4945. , CONSTRAINT rra_customerinvoicesearch_KEY0_pk PRIMARY KEY (ardivisionno,customerno,itemcode,invoiceno,headerseqno,detailseqno)
  4946. , CONSTRAINT rra_customerinvoicesearch_KEY0_check CHECK (ardivisionno is not null and customerno is not null and itemcode is not null and invoiceno is not null and headerseqno is not null and detailseqno IS NOT NULL)
  4947. ) WITH (OIDS=FALSE);
  4948. CREATE INDEX rra_customerinvoicesearch_KEY1_index ON sageimport.rra_customerinvoicesearch (invoiceno,ardivisionno,customerno,itemcode,headerseqno,detailseqno);
  4949.  
  4950.  
  4951. CREATE TABLE sageimport.rra_deleterenumbermergexref(
  4952. recordtype varchar(1)
  4953. , itemcode varchar(30)
  4954. , itemtype varchar(1)
  4955. , rmano varchar(7)
  4956. , rmadetaillinekey varchar(6)
  4957. , apdivisionno varchar(2)
  4958. , vendorno varchar(7)
  4959. , CONSTRAINT rra_deleterenumbermergexref_KEY0_pk PRIMARY KEY (recordtype,rmano,rmadetaillinekey)
  4960. , CONSTRAINT rra_deleterenumbermergexref_KEY0_check CHECK (recordtype is not null and rmano is not null and rmadetaillinekey IS NOT NULL)
  4961. ) WITH (OIDS=FALSE);
  4962. CREATE INDEX rra_deleterenumbermergexref_KEY1_index ON sageimport.rra_deleterenumbermergexref (recordtype,itemcode,rmano,rmadetaillinekey);
  4963. CREATE INDEX rra_deleterenumbermergexref_KEY2_index ON sageimport.rra_deleterenumbermergexref (recordtype,apdivisionno,vendorno,rmano,rmadetaillinekey);
  4964. CREATE INDEX rra_deleterenumbermergexref_KEY3_index ON sageimport.rra_deleterenumbermergexref (itemcode,recordtype,rmano,rmadetaillinekey);
  4965.  
  4966.  
  4967. CREATE TABLE sageimport.rra_inquiryreceiptshistorylink(
  4968. rmano varchar(7)
  4969. , receiptseqno varchar(6)
  4970. , ardivisionno varchar(2)
  4971. , customerno varchar(20)
  4972. , CONSTRAINT rra_inquiryreceiptshistorylink_KEY0_pk PRIMARY KEY (rmano,receiptseqno)
  4973. , CONSTRAINT rra_inquiryreceiptshistorylink_KEY0_check CHECK (rmano is not null and receiptseqno IS NOT NULL)
  4974. ) WITH (OIDS=FALSE);
  4975. CREATE INDEX rra_inquiryreceiptshistorylink_KEY1_index ON sageimport.rra_inquiryreceiptshistorylink (ardivisionno,customerno,rmano,receiptseqno);
  4976.  
  4977.  
  4978. CREATE TABLE sageimport.rra_options(
  4979. modulecode varchar(3)
  4980. , newsystem varchar(1)
  4981. , nextrmano varchar(7)
  4982. , applyrestockingcharges varchar(1)
  4983. , defaultrestockingitemcode varchar(30)
  4984. , trackrepairitemsthruinventory varchar(1)
  4985. , setrepairunitcosttozerodollars varchar(1)
  4986. , allowrestockchargeoverride varchar(1)
  4987. , consolidaterestockcharges varchar(1)
  4988. , retainrmareceipthistory varchar(1)
  4989. , integratepurchaseorder varchar(1)
  4990. , generatezerodocuments varchar(1)
  4991. , extendwarrantybasedon varchar(1)
  4992. , customeraction varchar(1)
  4993. , itemaction varchar(1)
  4994. , vendoraction varchar(1)
  4995. , returndefaultwhse varchar(3)
  4996. , allowreturnwhsechanges varchar(1)
  4997. , scrapdefaultwhse varchar(3)
  4998. , allowscrapwhsechanges varchar(1)
  4999. , defaultrepairwhse varchar(3)
  5000. , allowrepairwhsechanges varchar(1)
  5001. , returnreasoncode varchar(10)
  5002. , creditfreight varchar(1)
  5003. , invoicenorequired varchar(1)
  5004. , autodisplayitemselection varchar(1)
  5005. , customerwarrantychecking varchar(1)
  5006. , allowspecialitemreturns varchar(1)
  5007. , validateqtyreturned varchar(1)
  5008. , allowlineentrypriceoverride varchar(1)
  5009. , allowlineentrycostoverride varchar(1)
  5010. , displaylineentryunitcost varchar(1)
  5011. , printcustomerrmas varchar(1)
  5012. , printrmareceiverdocumentsby varchar(1)
  5013. , allowreturnreasoncodesotf varchar(1)
  5014. , returnshipvia varchar(15)
  5015. , checkqtyonhand varchar(1)
  5016. , defaultqtyretrndtoqtyshipped varchar(1)
  5017. , applycommentsall varchar(1)
  5018. , customerrma varchar(1)
  5019. , rmareceiver varchar(1)
  5020. , salesorder varchar(1)
  5021. , creditmemo varchar(1)
  5022. , defaultscrapacctkey varchar(9)
  5023. , repairsinprocessacctkey varchar(9)
  5024. , repairsclearingacctkey varchar(9)
  5025. , companycode varchar(3)
  5026. , daysbeforermaexpires numeric(15,4)
  5027. , dataversion numeric(15,4)
  5028. , dateupdated date
  5029. , timeupdated varchar(8)
  5030. , userupdatedkey varchar(10)
  5031. , CONSTRAINT rra_options_KEY0_pk PRIMARY KEY (modulecode)
  5032. , CONSTRAINT rra_options_KEY0_check CHECK (modulecode IS NOT NULL)
  5033. ) WITH (OIDS=FALSE);
  5034.  
  5035.  
  5036. CREATE TABLE sageimport.rra_receiptshistorydetail(
  5037. rmano varchar(7)
  5038. , receiptdetailseqno varchar(6)
  5039. , receiptseqno varchar(6)
  5040. , invoiceno varchar(7)
  5041. , headerseqno varchar(6)
  5042. , detailseqno varchar(6)
  5043. , itemcode varchar(30)
  5044. , itemtype varchar(1)
  5045. , itemcodedesc varchar(30)
  5046. , extendeddescriptionkey varchar(10)
  5047. , customeraction varchar(1)
  5048. , itemaction varchar(1)
  5049. , warehousecode varchar(3)
  5050. , replacementitemcode varchar(30)
  5051. , replacementitemtype varchar(1)
  5052. , vendoraction varchar(1)
  5053. , apdivisionno varchar(2)
  5054. , vendorno varchar(7)
  5055. , returnreasoncode varchar(10)
  5056. , unitofmeasure varchar(4)
  5057. , dropship varchar(1)
  5058. , crossship varchar(1)
  5059. , creditfreight varchar(1)
  5060. , xpresssocreated varchar(1)
  5061. , aliasitemno varchar(30)
  5062. , warrantycode varchar(10)
  5063. , expirationdate date
  5064. , expirationdateoverridden varchar(1)
  5065. , socostoverridden varchar(1)
  5066. , costofgoodssoldacctkey varchar(9)
  5067. , salesacctkey varchar(9)
  5068. , revision varchar(3)
  5069. , billoption1 varchar(2)
  5070. , billoption2 varchar(2)
  5071. , billoption3 varchar(2)
  5072. , billoption4 varchar(2)
  5073. , billoption5 varchar(2)
  5074. , billoption6 varchar(2)
  5075. , billoption7 varchar(2)
  5076. , billoption8 varchar(2)
  5077. , billoption9 varchar(2)
  5078. , saleskitlinekey varchar(6)
  5079. , explodedkititem varchar(1)
  5080. , standardkitbill varchar(1)
  5081. , backorderkitcomplines varchar(1)
  5082. , commenttext text
  5083. , applycommentstoall varchar(1)
  5084. , applytocustomerrma varchar(1)
  5085. , applytormareceiver varchar(1)
  5086. , applytosalesorder varchar(1)
  5087. , applytocreditmemo varchar(1)
  5088. , vendorrmano varchar(10)
  5089. , invoicenotonfile varchar(1)
  5090. , salesorderno varchar(7)
  5091. , customerpono varchar(30)
  5092. , replacementrevision varchar(3)
  5093. , replacementrepairbilloption1 varchar(2)
  5094. , replacementrepairbilloption2 varchar(2)
  5095. , replacementrepairbilloption3 varchar(2)
  5096. , replacementrepairbilloption4 varchar(2)
  5097. , replacementrepairbilloption5 varchar(2)
  5098. , replacementrepairbilloption6 varchar(2)
  5099. , replacementrepairbilloption7 varchar(2)
  5100. , replacementrepairbilloption8 varchar(2)
  5101. , replacementrepairbilloption9 varchar(2)
  5102. , productline varchar(4)
  5103. , valuation varchar(1)
  5104. , xpressgeneratedsono varchar(7)
  5105. , generatedcminvoiceno varchar(7)
  5106. , generatedpurchaseorderno varchar(7)
  5107. , generatedporeturnno varchar(7)
  5108. , salespersondivisionno varchar(2)
  5109. , salespersonno varchar(4)
  5110. , quantityreturned numeric(15,4)
  5111. , quantityreceived numeric(15,4)
  5112. , quantityremaining numeric(15,4)
  5113. , invoiceunitprice numeric(15,4)
  5114. , extensionamt numeric(15,4)
  5115. , restockingcharge numeric(15,4)
  5116. , invoiceunitcost numeric(15,4)
  5117. , unitofmeasureconvfactor numeric(15,4)
  5118. , quantityperbill numeric(15,4)
  5119. , CONSTRAINT rra_receiptshistorydetail_KEY0_pk PRIMARY KEY (rmano,receiptseqno,receiptdetailseqno)
  5120. , CONSTRAINT rra_receiptshistorydetail_KEY0_check CHECK (rmano is not null and receiptseqno is not null and receiptdetailseqno IS NOT NULL)
  5121. ) WITH (OIDS=FALSE);
  5122. CREATE INDEX rra_receiptshistorydetail_KEY1_index ON sageimport.rra_receiptshistorydetail (extendeddescriptionkey,rmano,receiptdetailseqno,receiptseqno);
  5123.  
  5124.  
  5125. CREATE TABLE sageimport.rra_receiptshistoryheader(
  5126. rmano varchar(7)
  5127. , receiptseqno varchar(6)
  5128. , rmadate date
  5129. , ardivisionno varchar(2)
  5130. , customerno varchar(20)
  5131. , rmastatus varchar(1)
  5132. , returnshipvia varchar(15)
  5133. , shiptocode varchar(4)
  5134. , confirmto varchar(30)
  5135. , comment varchar(30)
  5136. , emailaddress varchar(250)
  5137. , faxno varchar(17)
  5138. , inspectonreceipt varchar(1)
  5139. , applyrestockingcharges varchar(1)
  5140. , crossship varchar(1)
  5141. , billtoname varchar(30)
  5142. , billtoaddress1 varchar(30)
  5143. , billtoaddress2 varchar(30)
  5144. , billtoaddress3 varchar(30)
  5145. , billtocity varchar(20)
  5146. , billtostate varchar(2)
  5147. , billtozipcode varchar(10)
  5148. , billtocountrycode varchar(3)
  5149. , shiptoname varchar(30)
  5150. , shiptoaddress1 varchar(30)
  5151. , shiptoaddress2 varchar(30)
  5152. , shiptoaddress3 varchar(30)
  5153. , shiptocity varchar(20)
  5154. , shiptostate varchar(2)
  5155. , shiptozipcode varchar(10)
  5156. , shiptocountrycode varchar(3)
  5157. , returntoaddresscode varchar(4)
  5158. , returntoname varchar(30)
  5159. , returntoaddress1 varchar(30)
  5160. , returntoaddress2 varchar(30)
  5161. , returntoaddress3 varchar(30)
  5162. , returntocity varchar(20)
  5163. , returntostate varchar(2)
  5164. , returntozipcode varchar(10)
  5165. , returntocountrycode varchar(3)
  5166. , receiptdate date
  5167. , residentialaddress varchar(1)
  5168. , dateupdated date
  5169. , timeupdated varchar(8)
  5170. , userupdatedkey varchar(10)
  5171. , billtodivisionno varchar(2)
  5172. , billtocustomerno varchar(20)
  5173. , datecreated date
  5174. , timecreated varchar(8)
  5175. , usercreatedkey varchar(10)
  5176. , CONSTRAINT rra_receiptshistoryheader_KEY0_pk PRIMARY KEY (rmano,receiptseqno)
  5177. , CONSTRAINT rra_receiptshistoryheader_KEY0_check CHECK (rmano is not null and receiptseqno IS NOT NULL)
  5178. ) WITH (OIDS=FALSE);
  5179. CREATE INDEX rra_receiptshistoryheader_KEY1_index ON sageimport.rra_receiptshistoryheader (ardivisionno,customerno,rmano,receiptseqno);
  5180. CREATE INDEX rra_receiptshistoryheader_KEY2_index ON sageimport.rra_receiptshistoryheader (billtoname,rmano,receiptseqno);
  5181. CREATE INDEX rra_receiptshistoryheader_KEY3_index ON sageimport.rra_receiptshistoryheader (receiptdate,rmano,receiptseqno);
  5182.  
  5183.  
  5184. CREATE TABLE sageimport.rra_returndetail(
  5185. rmano varchar(7)
  5186. , linekey varchar(6)
  5187. , lineseqno varchar(14)
  5188. , invoiceno varchar(7)
  5189. , headerseqno varchar(6)
  5190. , detailseqno varchar(6)
  5191. , itemcode varchar(30)
  5192. , itemtype varchar(1)
  5193. , itemcodedesc varchar(30)
  5194. , extendeddescriptionkey varchar(10)
  5195. , returnreasoncode varchar(10)
  5196. , customeraction varchar(1)
  5197. , itemaction varchar(1)
  5198. , warehousecode varchar(3)
  5199. , vendoraction varchar(1)
  5200. , apdivisionno varchar(2)
  5201. , vendorno varchar(7)
  5202. , replacementitemcode varchar(30)
  5203. , replacementitemtype varchar(1)
  5204. , unitofmeasure varchar(4)
  5205. , dropship varchar(1)
  5206. , crossship varchar(1)
  5207. , creditfreight varchar(1)
  5208. , xpresssocreated varchar(1)
  5209. , aliasitemno varchar(30)
  5210. , warrantycode varchar(10)
  5211. , expirationdate date
  5212. , expirationdateoverridden varchar(1)
  5213. , costoverridden varchar(1)
  5214. , costofgoodssoldacctkey varchar(9)
  5215. , salesacctkey varchar(9)
  5216. , saleskitlinekey varchar(6)
  5217. , explodedkititem varchar(1)
  5218. , standardkitbill varchar(1)
  5219. , revision varchar(3)
  5220. , billoption1 varchar(2)
  5221. , billoption2 varchar(2)
  5222. , billoption3 varchar(2)
  5223. , billoption4 varchar(2)
  5224. , billoption5 varchar(2)
  5225. , billoption6 varchar(2)
  5226. , billoption7 varchar(2)
  5227. , billoption8 varchar(2)
  5228. , billoption9 varchar(2)
  5229. , backorderkitcomplines varchar(1)
  5230. , applycommentstoall varchar(1)
  5231. , applytocustomerrma varchar(1)
  5232. , applytormareceiver varchar(1)
  5233. , applytosalesorder varchar(1)
  5234. , applytocreditmemo varchar(1)
  5235. , vendorrmano varchar(10)
  5236. , invoicenotonfile varchar(1)
  5237. , salesorderno varchar(7)
  5238. , customerpono varchar(30)
  5239. , replacementrevision varchar(3)
  5240. , replacementrepairbilloption1 varchar(2)
  5241. , replacementrepairbilloption2 varchar(2)
  5242. , replacementrepairbilloption3 varchar(2)
  5243. , replacementrepairbilloption4 varchar(2)
  5244. , replacementrepairbilloption5 varchar(2)
  5245. , replacementrepairbilloption6 varchar(2)
  5246. , replacementrepairbilloption7 varchar(2)
  5247. , replacementrepairbilloption8 varchar(2)
  5248. , replacementrepairbilloption9 varchar(2)
  5249. , productline varchar(4)
  5250. , valuation varchar(1)
  5251. , commenttext text
  5252. , discount varchar(1)
  5253. , pricelevel varchar(1)
  5254. , taxclass varchar(2)
  5255. , subjecttoexemption varchar(1)
  5256. , commissionable varchar(1)
  5257. , salespersondivisionno varchar(2)
  5258. , salespersonno varchar(4)
  5259. , xpresssalesorderno varchar(7)
  5260. , priceoverridden varchar(1)
  5261. , historywarehousecode varchar(3)
  5262. , historycogsacctkey varchar(9)
  5263. , skipprintcompline varchar(1)
  5264. , quantityreturned numeric(15,4)
  5265. , quantityreceived numeric(15,4)
  5266. , quantityremaining numeric(15,4)
  5267. , invoiceunitprice numeric(15,4)
  5268. , extensionamt numeric(15,4)
  5269. , restockingcharge numeric(15,4)
  5270. , invoiceunitcost numeric(15,4)
  5271. , unitofmeasureconvfactor numeric(15,4)
  5272. , quantityperbill numeric(15,4)
  5273. , originalprice numeric(15,4)
  5274. , originalcost numeric(15,4)
  5275. , invoicehistoryqty numeric(15,4)
  5276. , linediscountpercent numeric(15,4)
  5277. , CONSTRAINT rra_returndetail_KEY0_pk PRIMARY KEY (rmano,linekey)
  5278. , CONSTRAINT rra_returndetail_KEY0_check CHECK (rmano is not null and linekey IS NOT NULL)
  5279. ) WITH (OIDS=FALSE);
  5280. CREATE INDEX rra_returndetail_KEY1_index ON sageimport.rra_returndetail (rmano,lineseqno,linekey);
  5281. CREATE INDEX rra_returndetail_KEY2_index ON sageimport.rra_returndetail (extendeddescriptionkey,rmano,linekey);
  5282. CREATE INDEX rra_returndetail_KEY3_index ON sageimport.rra_returndetail (itemcode,warehousecode,rmano,linekey);
  5283.  
  5284.  
  5285. CREATE TABLE sageimport.rra_returnheader(
  5286. rmano varchar(7)
  5287. , rmadate date
  5288. , ardivisionno varchar(2)
  5289. , customerno varchar(20)
  5290. , rmastatus varchar(1)
  5291. , expiredate date
  5292. , returnshipvia varchar(15)
  5293. , shiptocode varchar(4)
  5294. , confirmto varchar(30)
  5295. , comment varchar(30)
  5296. , emailaddress varchar(250)
  5297. , faxno varchar(17)
  5298. , batchfax varchar(1)
  5299. , inspectonreceipt varchar(1)
  5300. , applyrestockingcharges varchar(1)
  5301. , crossship varchar(1)
  5302. , printcustomerrma varchar(1)
  5303. , printrmareceiver varchar(1)
  5304. , billtoname varchar(30)
  5305. , billtoaddress1 varchar(30)
  5306. , billtoaddress2 varchar(30)
  5307. , billtoaddress3 varchar(30)
  5308. , billtocity varchar(20)
  5309. , billtostate varchar(2)
  5310. , billtozipcode varchar(10)
  5311. , billtocountrycode varchar(3)
  5312. , shiptoname varchar(30)
  5313. , shiptoaddress1 varchar(30)
  5314. , shiptoaddress2 varchar(30)
  5315. , shiptoaddress3 varchar(30)
  5316. , shiptocity varchar(20)
  5317. , shiptostate varchar(2)
  5318. , shiptozipcode varchar(10)
  5319. , shiptocountrycode varchar(3)
  5320. , returntoaddresscode varchar(4)
  5321. , returntoname varchar(30)
  5322. , returntoaddress1 varchar(30)
  5323. , returntoaddress2 varchar(30)
  5324. , returntoaddress3 varchar(30)
  5325. , returntocity varchar(20)
  5326. , returntostate varchar(2)
  5327. , returntozipcode varchar(10)
  5328. , returntocountrycode varchar(3)
  5329. , residentialaddress varchar(1)
  5330. , datecreated date
  5331. , timecreated varchar(8)
  5332. , usercreatedkey varchar(10)
  5333. , dateupdated date
  5334. , timeupdated varchar(8)
  5335. , userupdatedkey varchar(10)
  5336. , billtodivisionno varchar(2)
  5337. , billtocustomerno varchar(20)
  5338. , CONSTRAINT rra_returnheader_KEY0_pk PRIMARY KEY (rmano)
  5339. , CONSTRAINT rra_returnheader_KEY0_check CHECK (rmano IS NOT NULL)
  5340. ) WITH (OIDS=FALSE);
  5341. CREATE INDEX rra_returnheader_KEY1_index ON sageimport.rra_returnheader (ardivisionno,customerno,rmano);
  5342. CREATE INDEX rra_returnheader_KEY2_index ON sageimport.rra_returnheader (rmadate,rmano);
  5343. CREATE INDEX rra_returnheader_KEY3_index ON sageimport.rra_returnheader (billtoname,rmano);
  5344. CREATE INDEX rra_returnheader_KEY4_index ON sageimport.rra_returnheader (billtodivisionno,billtocustomerno,rmano);
  5345.  
  5346.  
  5347. CREATE TABLE sageimport.rra_returnprint(
  5348. printtype varchar(1)
  5349. , rmano varchar(7)
  5350. , CONSTRAINT rra_returnprint_KEY0_pk PRIMARY KEY (printtype,rmano)
  5351. , CONSTRAINT rra_returnprint_KEY0_check CHECK (printtype is not null and rmano IS NOT NULL)
  5352. ) WITH (OIDS=FALSE);
  5353.  
  5354.  
  5355. CREATE TABLE sageimport.rra_returnreasoncode(
  5356. returnreasoncode varchar(10)
  5357. , returnreasoncodedesc varchar(30)
  5358. , datecreated date
  5359. , timecreated varchar(8)
  5360. , usercreatedkey varchar(10)
  5361. , dateupdated date
  5362. , timeupdated varchar(8)
  5363. , userupdatedkey varchar(10)
  5364. , CONSTRAINT rra_returnreasoncode_KEY0_pk PRIMARY KEY (returnreasoncode)
  5365. , CONSTRAINT rra_returnreasoncode_KEY0_check CHECK (returnreasoncode IS NOT NULL)
  5366. ) WITH (OIDS=FALSE);
  5367.  
  5368.  
  5369. CREATE TABLE sageimport.rra_returnreasondetail(
  5370. itemcode varchar(30)
  5371. , itemtype varchar(1)
  5372. , receiptdate date
  5373. , rmano varchar(7)
  5374. , sequenceno varchar(6)
  5375. , returnreasoncode varchar(10)
  5376. , itemaction varchar(1)
  5377. , itemcodedesc varchar(30)
  5378. , productline varchar(4)
  5379. , unitofmeasure varchar(4)
  5380. , warehousecode varchar(3)
  5381. , ardivisionno varchar(2)
  5382. , customerno varchar(20)
  5383. , customeraction varchar(1)
  5384. , apdivisionno varchar(2)
  5385. , vendorno varchar(7)
  5386. , vendoraction varchar(1)
  5387. , salespersondivisionno varchar(2)
  5388. , salespersonno varchar(4)
  5389. , quantityreturnedactual numeric(15,4)
  5390. , dateupdated date
  5391. , timeupdated varchar(8)
  5392. , userupdatedkey varchar(10)
  5393. , CONSTRAINT rra_returnreasondetail_KEY0_pk PRIMARY KEY (itemcode,receiptdate,rmano,sequenceno)
  5394. , CONSTRAINT rra_returnreasondetail_KEY0_check CHECK (itemcode is not null and receiptdate is not null and rmano is not null and sequenceno IS NOT NULL)
  5395. ) WITH (OIDS=FALSE);
  5396. CREATE INDEX rra_returnreasondetail_KEY1_index ON sageimport.rra_returnreasondetail (returnreasoncode,itemcode,receiptdate,rmano,sequenceno);
  5397. CREATE INDEX rra_returnreasondetail_KEY2_index ON sageimport.rra_returnreasondetail (productline,itemcode,receiptdate,rmano,sequenceno);
  5398. CREATE INDEX rra_returnreasondetail_KEY3_index ON sageimport.rra_returnreasondetail (ardivisionno,customerno,itemcode,receiptdate,rmano,sequenceno);
  5399. CREATE INDEX rra_returnreasondetail_KEY4_index ON sageimport.rra_returnreasondetail (apdivisionno,vendorno,itemcode,receiptdate,rmano,sequenceno);
  5400. CREATE INDEX rra_returnreasondetail_KEY5_index ON sageimport.rra_returnreasondetail (receiptdate,itemcode,rmano,sequenceno);
  5401.  
  5402.  
  5403. CREATE TABLE sageimport.rra_returntoaddresscode(
  5404. returntoaddresscode varchar(4)
  5405. , returntoaddresscodedesc varchar(30)
  5406. , returntoname varchar(30)
  5407. , returntoaddress1 varchar(30)
  5408. , returntoaddress2 varchar(30)
  5409. , returntoaddress3 varchar(30)
  5410. , returntocity varchar(20)
  5411. , returntostate varchar(2)
  5412. , returntozipcode varchar(10)
  5413. , returntocountrycode varchar(3)
  5414. , datecreated date
  5415. , timecreated varchar(8)
  5416. , usercreatedkey varchar(10)
  5417. , dateupdated date
  5418. , timeupdated varchar(8)
  5419. , userupdatedkey varchar(10)
  5420. , CONSTRAINT rra_returntoaddresscode_KEY0_pk PRIMARY KEY (returntoaddresscode)
  5421. , CONSTRAINT rra_returntoaddresscode_KEY0_check CHECK (returntoaddresscode IS NOT NULL)
  5422. ) WITH (OIDS=FALSE);
  5423.  
  5424.  
  5425. CREATE TABLE sageimport.rso_arinvoicehistorylink(
  5426. salesorderno varchar(7)
  5427. , sequenceno varchar(14)
  5428. , invoiceno varchar(7)
  5429. , invoicehistoryheaderseqno varchar(6)
  5430. , invoicehistorydetailseqno varchar(6)
  5431. , invoicedate date
  5432. , unitofmeasure varchar(4)
  5433. , quantityshipped numeric(15,4)
  5434. , unitprice numeric(15,4)
  5435. , CONSTRAINT rso_arinvoicehistorylink_KEY0_pk PRIMARY KEY (salesorderno,sequenceno,invoiceno,invoicehistoryheaderseqno,invoicehistorydetailseqno)
  5436. , CONSTRAINT rso_arinvoicehistorylink_KEY0_check CHECK (salesorderno is not null and sequenceno is not null and invoiceno is not null and invoicehistoryheaderseqno is not null and invoicehistorydetailseqno IS NOT NULL)
  5437. ) WITH (OIDS=FALSE);
  5438.  
  5439.  
  5440. CREATE TABLE sageimport.rso_cancelreasoncode(
  5441. cancelreasoncode varchar(5)
  5442. , cancelreasoncodedesc varchar(30)
  5443. , datecreated date
  5444. , timecreated varchar(8)
  5445. , usercreatedkey varchar(10)
  5446. , dateupdated date
  5447. , timeupdated varchar(8)
  5448. , userupdatedkey varchar(10)
  5449. , inactivecancelreasoncode varchar(1)
  5450. , CONSTRAINT rso_cancelreasoncode_KEY0_pk PRIMARY KEY (cancelreasoncode)
  5451. , CONSTRAINT rso_cancelreasoncode_KEY0_check CHECK (cancelreasoncode IS NOT NULL)
  5452. ) WITH (OIDS=FALSE);
  5453.  
  5454.  
  5455. CREATE TABLE sageimport.rso_invoiceheader(
  5456. invoiceno varchar(7)
  5457. , invoicedate date
  5458. , invoicetype varchar(2)
  5459. , salesorderno varchar(7)
  5460. , ordertype varchar(1)
  5461. , orderstatus varchar(1)
  5462. , orderdate date
  5463. , ardivisionno varchar(2)
  5464. , customerno varchar(20)
  5465. , billtoname varchar(30)
  5466. , billtoaddress1 varchar(30)
  5467. , billtoaddress2 varchar(30)
  5468. , billtoaddress3 varchar(30)
  5469. , billtocity varchar(20)
  5470. , billtostate varchar(2)
  5471. , billtozipcode varchar(10)
  5472. , billtocountrycode varchar(3)
  5473. , shiptocode varchar(4)
  5474. , shiptoname varchar(30)
  5475. , shiptoaddress1 varchar(30)
  5476. , shiptoaddress2 varchar(30)
  5477. , shiptoaddress3 varchar(30)
  5478. , shiptocity varchar(20)
  5479. , shiptostate varchar(2)
  5480. , shiptozipcode varchar(10)
  5481. , shiptocountrycode varchar(3)
  5482. , shipdate date
  5483. , shipvia varchar(15)
  5484. , shipzone varchar(5)
  5485. , shipzoneactual varchar(5)
  5486. , shipweight varchar(5)
  5487. , customerpono varchar(30)
  5488. , fob varchar(15)
  5489. , warehousecode varchar(3)
  5490. , confirmto varchar(30)
  5491. , comment varchar(30)
  5492. , taxschedule varchar(9)
  5493. , termscode varchar(2)
  5494. , taxexemptno varchar(15)
  5495. , printinvoice varchar(1)
  5496. , invoiceprinted varchar(1)
  5497. , acceptcashonly varchar(1)
  5498. , customertype varchar(4)
  5499. , residentialaddress varchar(1)
  5500. , invalidtaxcalc varchar(1)
  5501. , freightcalculationmethod varchar(1)
  5502. , checknofordeposit varchar(10)
  5503. , applytoinvoiceno varchar(7)
  5504. , lotseriallinesexist varchar(1)
  5505. , salespersondivisionno varchar(2)
  5506. , salespersonno varchar(4)
  5507. , splitcommissions varchar(1)
  5508. , salespersondivisionno2 varchar(2)
  5509. , salespersonno2 varchar(4)
  5510. , salespersondivisionno3 varchar(2)
  5511. , salespersonno3 varchar(4)
  5512. , salespersondivisionno4 varchar(2)
  5513. , salespersonno4 varchar(4)
  5514. , salespersondivisionno5 varchar(2)
  5515. , salespersonno5 varchar(4)
  5516. , invoiceduedate date
  5517. , discountduedate date
  5518. , batchno varchar(5)
  5519. , ebmsubmissiontype varchar(1)
  5520. , ebmuseridsubmittingthisorder varchar(15)
  5521. , ebmusertype varchar(1)
  5522. , emailupdateflagforrestart varchar(1)
  5523. , faxno varchar(17)
  5524. , batchfax varchar(1)
  5525. , batchemail varchar(1)
  5526. , emailaddress varchar(250)
  5527. , paymenttype varchar(5)
  5528. , paymenttypecategory varchar(1)
  5529. , otherpaymenttyperefno varchar(24)
  5530. , orderchangedinshipping varchar(1)
  5531. , lineschangedinshipping varchar(1)
  5532. , shipperid varchar(3)
  5533. , shipstatus varchar(1)
  5534. , starshipfreightused varchar(1)
  5535. , starshiprecordscreated varchar(1)
  5536. , jobno varchar(7)
  5537. , rmano varchar(7)
  5538. , crmuserid varchar(11)
  5539. , crmcompanyid varchar(11)
  5540. , crmpersonid varchar(11)
  5541. , crmopportunityid varchar(11)
  5542. , invalidwarrantycode varchar(1)
  5543. , taxablesubjecttodiscount numeric(15,4)
  5544. , nontaxablesubjecttodiscount numeric(15,4)
  5545. , taxsubjtodiscprcntoftotsubjto numeric(15,4)
  5546. , discountrate numeric(15,4)
  5547. , taxableamt numeric(15,4)
  5548. , nontaxableamt numeric(15,4)
  5549. , salestaxamt numeric(15,4)
  5550. , discountamt numeric(15,4)
  5551. , retentionamt numeric(15,4)
  5552. , totalsubjecttocomm numeric(15,4)
  5553. , commissionrate numeric(15,4)
  5554. , commissionamt numeric(15,4)
  5555. , splitcommrate2 numeric(15,4)
  5556. , splitcommrate3 numeric(15,4)
  5557. , splitcommrate4 numeric(15,4)
  5558. , splitcommrate5 numeric(15,4)
  5559. , overridecommamt numeric(15,4)
  5560. , freightamt numeric(15,4)
  5561. , costofgoodssoldamt numeric(15,4)
  5562. , costofgoodssoldsubjtocomm numeric(15,4)
  5563. , depositamt numeric(15,4)
  5564. , weight numeric(15,4)
  5565. , sishippedlinescogs numeric(15,4)
  5566. , numberofcodlabels numeric(15,4)
  5567. , numberofbackorderlines numeric(15,4)
  5568. , numberofshippinglabels numeric(15,4)
  5569. , lastnoofshippinglabels numeric(15,4)
  5570. , numberofpackages numeric(15,4)
  5571. , datecreated date
  5572. , timecreated varchar(8)
  5573. , usercreatedkey varchar(10)
  5574. , dateupdated date
  5575. , timeupdated varchar(8)
  5576. , userupdatedkey varchar(10)
  5577. , billtodivisionno varchar(2)
  5578. , billtocustomerno varchar(20)
  5579. , CONSTRAINT rso_invoiceheader_KEY0_pk PRIMARY KEY (invoiceno)
  5580. , CONSTRAINT rso_invoiceheader_KEY0_check CHECK (invoiceno IS NOT NULL)
  5581. ) WITH (OIDS=FALSE);
  5582. CREATE INDEX rso_invoiceheader_KEY1_index ON sageimport.rso_invoiceheader (batchno,invoiceno);
  5583. CREATE INDEX rso_invoiceheader_KEY2_index ON sageimport.rso_invoiceheader (ardivisionno,customerno,invoiceno);
  5584. CREATE INDEX rso_invoiceheader_KEY3_index ON sageimport.rso_invoiceheader (crmcompanyid,invoiceno);
  5585. CREATE INDEX rso_invoiceheader_KEY4_index ON sageimport.rso_invoiceheader (crmpersonid,invoiceno);
  5586. CREATE INDEX rso_invoiceheader_KEY5_index ON sageimport.rso_invoiceheader (ardivisionno,customerno,customerpono,invoiceno);
  5587. CREATE INDEX rso_invoiceheader_KEY6_index ON sageimport.rso_invoiceheader (billtodivisionno,billtocustomerno,invoiceno);
  5588.  
  5589.  
  5590. CREATE TABLE sageimport.rso_invoicehistorylink(
  5591. salesorderno varchar(7)
  5592. , invoiceno varchar(7)
  5593. , invoicehistoryheaderseqno varchar(6)
  5594. , invoicedate date
  5595. , invoicetotal numeric(15,4)
  5596. , CONSTRAINT rso_invoicehistorylink_KEY0_pk PRIMARY KEY (salesorderno,invoiceno,invoicehistoryheaderseqno)
  5597. , CONSTRAINT rso_invoicehistorylink_KEY0_check CHECK (salesorderno is not null and invoiceno is not null and invoicehistoryheaderseqno IS NOT NULL)
  5598. ) WITH (OIDS=FALSE);
  5599.  
  5600.  
  5601. CREATE TABLE sageimport.rso_lastpurchasehistory(
  5602. ardivisionno varchar(2)
  5603. , customerno varchar(20)
  5604. , itemcode varchar(30)
  5605. , documenttype varchar(1)
  5606. , lastpurchasedate date
  5607. , lastpurchaseqty numeric(15,4)
  5608. , lastunitprice numeric(15,4)
  5609. , dateupdated date
  5610. , timeupdated varchar(8)
  5611. , userupdatedkey varchar(10)
  5612. , CONSTRAINT rso_lastpurchasehistory_KEY0_pk PRIMARY KEY (ardivisionno,customerno,itemcode,documenttype)
  5613. , CONSTRAINT rso_lastpurchasehistory_KEY0_check CHECK (ardivisionno is not null and customerno is not null and itemcode is not null and documenttype IS NOT NULL)
  5614. ) WITH (OIDS=FALSE);
  5615.  
  5616.  
  5617. CREATE TABLE sageimport.rso_openorderdetailbyitem(
  5618. recordtype varchar(1)
  5619. , itemcode varchar(30)
  5620. , promisedate date
  5621. , salesorderno varchar(7)
  5622. , linekey varchar(6)
  5623. , CONSTRAINT rso_openorderdetailbyitem_KEY0_pk PRIMARY KEY (recordtype,itemcode,salesorderno,linekey)
  5624. , CONSTRAINT rso_openorderdetailbyitem_KEY0_check CHECK (recordtype is not null and itemcode is not null and salesorderno is not null and linekey IS NOT NULL)
  5625. ) WITH (OIDS=FALSE);
  5626. CREATE INDEX rso_openorderdetailbyitem_KEY1_index ON sageimport.rso_openorderdetailbyitem (recordtype,promisedate,salesorderno,linekey);
  5627.  
  5628.  
  5629. CREATE TABLE sageimport.rso_options(
  5630. modulecode varchar(3)
  5631. , newsystem varchar(1)
  5632. , defaultwarehousecode varchar(3)
  5633. , usealternatewhse varchar(1)
  5634. , usedefaultitemwhse varchar(1)
  5635. , splitcommissions varchar(1)
  5636. , useshippingcode varchar(1)
  5637. , nextsalesorderno varchar(7)
  5638. , nextinvoiceno varchar(7)
  5639. , currentcalendaryr varchar(4)
  5640. , currentfiscalyr varchar(4)
  5641. , currentperiod varchar(2)
  5642. , allowdiscountrate varchar(1)
  5643. , checkqtyonhand varchar(1)
  5644. , defaultspecialitemstods varchar(1)
  5645. , includebackorderedlines varchar(1)
  5646. , requirejobno varchar(1)
  5647. , allowjobstobecreated varchar(1)
  5648. , requirecostcode varchar(1)
  5649. , postinvoicecoststojc varchar(1)
  5650. , postsalesbydivision varchar(1)
  5651. , postdepositsbydiv varchar(1)
  5652. , postdepositsindetail varchar(1)
  5653. , printsalesorders varchar(1)
  5654. , printpickingsheets varchar(1)
  5655. , includekititems varchar(1)
  5656. , printshippinglabels varchar(1)
  5657. , printdailydropshiprpt varchar(1)
  5658. , printcodlabels varchar(1)
  5659. , customerdepacctkey varchar(9)
  5660. , specialitemsalesacctkey varchar(9)
  5661. , specialitemcogsacctkey varchar(9)
  5662. , specialitempurchasesacctkey varchar(9)
  5663. , printsalesjournalbydiv varchar(1)
  5664. , printgrossprofitjournal varchar(1)
  5665. , printgrossprftjrnlbyslsprson varchar(1)
  5666. , printdailybackorder varchar(1)
  5667. , printdailydepositrecap varchar(1)
  5668. , printtaxdetailonsalesjrnl varchar(1)
  5669. , printtaxjournalindetail varchar(1)
  5670. , printdailysalesrecap varchar(1)
  5671. , printrecapbyitem varchar(1)
  5672. , printwhsedetailforrecap varchar(1)
  5673. , printrecapbywhsebyitem varchar(1)
  5674. , printrecapbyproductline varchar(1)
  5675. , printrecapbywhsebyprodline varchar(1)
  5676. , printrecapbywhse varchar(1)
  5677. , printrecapbycustomer varchar(1)
  5678. , printrecapbydiv varchar(1)
  5679. , printbarcodesalesorders varchar(1)
  5680. , printbarcodepicksheets varchar(1)
  5681. , purgesorecap varchar(1)
  5682. , displayunitcost varchar(1)
  5683. , yearstoretainsaleshist numeric(15,4)
  5684. , retainbackorderedlines varchar(1)
  5685. , retainshiptodetail varchar(1)
  5686. , retainlotserialhistory varchar(1)
  5687. , retaincustlastpurchhistory varchar(1)
  5688. , retainorderquotehistory varchar(1)
  5689. , retaindeletedsalesorders varchar(1)
  5690. , retaindeletedlines varchar(1)
  5691. , displayprofitmargin varchar(1)
  5692. , enableshipping varchar(1)
  5693. , warrantycalcbasedon varchar(1)
  5694. , recalcexpiration varchar(1)
  5695. , integrategeneralledger varchar(1)
  5696. , integrateinventory varchar(1)
  5697. , integratejobcost varchar(1)
  5698. , periodendoptselection varchar(1)
  5699. , currentinvoiceupdate varchar(1)
  5700. , companycode varchar(3)
  5701. , defaultnooflabels numeric(15,4)
  5702. , profitmarginpercent numeric(15,4)
  5703. , dataversion numeric(15,4)
  5704. , dateupdated date
  5705. , timeupdated varchar(8)
  5706. , userupdatedkey varchar(10)
  5707. , customersplitcomoverrideshipto varchar(1)
  5708. , usedfltorderdatepromotingquote varchar(1)
  5709. , defaultdaysuntilquoteexpires numeric(15,4)
  5710. , displaymessage varchar(1)
  5711. , redisplayalldocuments varchar(1)
  5712. , redisplaysalesorders varchar(1)
  5713. , redisplaypickingsheets varchar(1)
  5714. , redisplayinvoices varchar(1)
  5715. , pickingsheetafterorder varchar(1)
  5716. , onlyfordefaultwhse varchar(1)
  5717. , shippinglabelsafterpicksheet varchar(1)
  5718. , codlabelsafterinvoice varchar(1)
  5719. , quickprintwithoutprintwindow varchar(1)
  5720. , enablepurchasecontrol varchar(1)
  5721. , selectitemsbasedon varchar(1)
  5722. , controlpurchasesbasedon varchar(1)
  5723. , enablepricebytotalqtybasedon varchar(1)
  5724. , unitofmeasurefortotalqty varchar(1)
  5725. , applypricingbytotalqtyauto varchar(1)
  5726. , enabledefaultpricelevelbycust varchar(1)
  5727. , basenewpricelevelrecordson varchar(1)
  5728. , enablelotserialdist varchar(1)
  5729. , requirefullydistributedlines varchar(1)
  5730. , checkarinvoicedataentry varchar(1)
  5731. , checkarinvoicehistory varchar(1)
  5732. , checksalesorderentry varchar(1)
  5733. , checksalesorderhistory varchar(1)
  5734. , checksoinvoicedataentry varchar(1)
  5735. , postinvoicecoststojobestimates varchar(1)
  5736. , postdropshipcoststojc varchar(1)
  5737. , relieveworkinprocess varchar(1)
  5738. , setjobstatustocompletewheninv varchar(1)
  5739. , includejobnoanddescinglcomment varchar(1)
  5740. , relieveinventory varchar(1)
  5741. , saleskitupdatemethod varchar(1)
  5742. , validatecustomer varchar(1)
  5743. , validsocosttypes varchar(12)
  5744. , usesoacctsforcogs varchar(1)
  5745. , usesoacctsforsales varchar(1)
  5746. , datasublevel numeric(15,4)
  5747. , CONSTRAINT rso_options_KEY0_pk PRIMARY KEY (modulecode)
  5748. , CONSTRAINT rso_options_KEY0_check CHECK (modulecode IS NOT NULL)
  5749. ) WITH (OIDS=FALSE);
  5750.  
  5751.  
  5752. CREATE TABLE sageimport.rso_recapbydivision(
  5753. ardivisionno varchar(2)
  5754. , year varchar(4)
  5755. , period varchar(2)
  5756. , quantityshipped numeric(15,4)
  5757. , quantityreturned numeric(15,4)
  5758. , dollarssold numeric(15,4)
  5759. , costofgoodssold numeric(15,4)
  5760. , dateupdated date
  5761. , timeupdated varchar(8)
  5762. , userupdatedkey varchar(10)
  5763. , CONSTRAINT rso_recapbydivision_KEY0_pk PRIMARY KEY (ardivisionno,year,period)
  5764. , CONSTRAINT rso_recapbydivision_KEY0_check CHECK (ardivisionno is not null and year is not null and period IS NOT NULL)
  5765. ) WITH (OIDS=FALSE);
  5766. CREATE INDEX rso_recapbydivision_KEY1_index ON sageimport.rso_recapbydivision (year,period,ardivisionno);
  5767.  
  5768.  
  5769. CREATE TABLE sageimport.rso_recapbyproductlinewhse(
  5770. productline varchar(4)
  5771. , warehousecode varchar(3)
  5772. , year varchar(4)
  5773. , period varchar(2)
  5774. , quantityshipped numeric(15,4)
  5775. , quantityreturned numeric(15,4)
  5776. , dollarssold numeric(15,4)
  5777. , costofgoodssold numeric(15,4)
  5778. , dateupdated date
  5779. , timeupdated varchar(8)
  5780. , userupdatedkey varchar(10)
  5781. , CONSTRAINT rso_recapbyproductlinewhse_KEY0_pk PRIMARY KEY (productline,warehousecode,year,period)
  5782. , CONSTRAINT rso_recapbyproductlinewhse_KEY0_check CHECK (productline is not null and warehousecode is not null and year is not null and period IS NOT NULL)
  5783. ) WITH (OIDS=FALSE);
  5784. CREATE INDEX rso_recapbyproductlinewhse_KEY1_index ON sageimport.rso_recapbyproductlinewhse (year,period,productline,warehousecode);
  5785.  
  5786.  
  5787. CREATE TABLE sageimport.rso_recapbywarehouse(
  5788. warehousecode varchar(3)
  5789. , year varchar(4)
  5790. , period varchar(2)
  5791. , quantityshipped numeric(15,4)
  5792. , quantityreturned numeric(15,4)
  5793. , dollarssold numeric(15,4)
  5794. , costofgoodssold numeric(15,4)
  5795. , dateupdated date
  5796. , timeupdated varchar(8)
  5797. , userupdatedkey varchar(10)
  5798. , CONSTRAINT rso_recapbywarehouse_KEY0_pk PRIMARY KEY (warehousecode,year,period)
  5799. , CONSTRAINT rso_recapbywarehouse_KEY0_check CHECK (warehousecode is not null and year is not null and period IS NOT NULL)
  5800. ) WITH (OIDS=FALSE);
  5801. CREATE INDEX rso_recapbywarehouse_KEY1_index ON sageimport.rso_recapbywarehouse (year,period,warehousecode);
  5802.  
  5803.  
  5804. CREATE TABLE sageimport.rso_saleshistory(
  5805. ardivisionno varchar(2)
  5806. , customerno varchar(20)
  5807. , itemcode varchar(30)
  5808. , itemtype varchar(1)
  5809. , productline varchar(4)
  5810. , warehousecode varchar(3)
  5811. , postingdate date
  5812. , invoicedate date
  5813. , dollarssold numeric(15,4)
  5814. , costofgoodssold numeric(15,4)
  5815. , quantityshipped numeric(15,4)
  5816. , quantityreturned numeric(15,4)
  5817. , dateupdated date
  5818. , timeupdated varchar(8)
  5819. , userupdatedkey varchar(10)
  5820. , CONSTRAINT rso_saleshistory_KEY0_pk PRIMARY KEY (ardivisionno,customerno,itemcode,itemtype,productline,warehousecode,postingdate,invoicedate)
  5821. , CONSTRAINT rso_saleshistory_KEY0_check CHECK (ardivisionno is not null and customerno is not null and itemcode is not null and itemtype is not null and productline is not null and warehousecode is not null and postingdate is not null and invoicedate IS NOT NULL)
  5822. ) WITH (OIDS=FALSE);
  5823. CREATE INDEX rso_saleshistory_KEY1_index ON sageimport.rso_saleshistory (itemcode);
  5824. CREATE INDEX rso_saleshistory_KEY10_index ON sageimport.rso_saleshistory (itemtype);
  5825. CREATE INDEX rso_saleshistory_KEY11_index ON sageimport.rso_saleshistory (ardivisionno,customerno);
  5826. CREATE INDEX rso_saleshistory_KEY12_index ON sageimport.rso_saleshistory (ardivisionno);
  5827. CREATE INDEX rso_saleshistory_KEY13_index ON sageimport.rso_saleshistory (ardivisionno,customerno,productline);
  5828. CREATE INDEX rso_saleshistory_KEY2_index ON sageimport.rso_saleshistory (productline);
  5829. CREATE INDEX rso_saleshistory_KEY3_index ON sageimport.rso_saleshistory (warehousecode);
  5830. CREATE INDEX rso_saleshistory_KEY4_index ON sageimport.rso_saleshistory (warehousecode,itemcode);
  5831. CREATE INDEX rso_saleshistory_KEY5_index ON sageimport.rso_saleshistory (warehousecode,productline);
  5832. CREATE INDEX rso_saleshistory_KEY6_index ON sageimport.rso_saleshistory (invoicedate);
  5833. CREATE INDEX rso_saleshistory_KEY7_index ON sageimport.rso_saleshistory (postingdate);
  5834. CREATE INDEX rso_saleshistory_KEY8_index ON sageimport.rso_saleshistory (itemcode,productline,warehousecode);
  5835. CREATE INDEX rso_saleshistory_KEY9_index ON sageimport.rso_saleshistory (productline,warehousecode);
  5836.  
  5837.  
  5838. CREATE TABLE sageimport.rso_salesorderdetail(
  5839. salesorderno varchar(7)
  5840. , linekey varchar(6)
  5841. , lineseqno varchar(14)
  5842. , itemcode varchar(30)
  5843. , itemtype varchar(1)
  5844. , itemcodedesc varchar(30)
  5845. , extendeddescriptionkey varchar(10)
  5846. , discount varchar(1)
  5847. , commissionable varchar(1)
  5848. , subjecttoexemption varchar(1)
  5849. , warehousecode varchar(3)
  5850. , pricelevel varchar(1)
  5851. , masterorderlinekey varchar(6)
  5852. , unitofmeasure varchar(4)
  5853. , dropship varchar(1)
  5854. , printdropshipment varchar(1)
  5855. , saleskitlinekey varchar(6)
  5856. , costofgoodssoldacctkey varchar(9)
  5857. , salesacctkey varchar(9)
  5858. , priceoverridden varchar(1)
  5859. , explodedkititem varchar(1)
  5860. , standardkitbill varchar(1)
  5861. , revision varchar(3)
  5862. , billoption1 varchar(2)
  5863. , billoption2 varchar(2)
  5864. , billoption3 varchar(2)
  5865. , billoption4 varchar(2)
  5866. , billoption5 varchar(2)
  5867. , billoption6 varchar(2)
  5868. , billoption7 varchar(2)
  5869. , billoption8 varchar(2)
  5870. , billoption9 varchar(2)
  5871. , backorderkitcompline varchar(1)
  5872. , skipprintcompline varchar(1)
  5873. , promisedate date
  5874. , aliasitemno varchar(30)
  5875. , sohistorydetlseqno varchar(14)
  5876. , taxclass varchar(2)
  5877. , customeraction varchar(1)
  5878. , itemaction varchar(1)
  5879. , warrantycode varchar(10)
  5880. , expirationdate date
  5881. , expirationoverridden varchar(1)
  5882. , costoverridden varchar(1)
  5883. , costcode varchar(9)
  5884. , costtype varchar(1)
  5885. , commenttext text
  5886. , quantityordered numeric(15,4)
  5887. , quantityshipped numeric(15,4)
  5888. , quantitybackordered numeric(15,4)
  5889. , masteroriginalqty numeric(15,4)
  5890. , masterqtybalance numeric(15,4)
  5891. , masterqtyorderedtodate numeric(15,4)
  5892. , repeatingqtyshippedtodate numeric(15,4)
  5893. , unitprice numeric(15,4)
  5894. , unitcost numeric(15,4)
  5895. , extensionamt numeric(15,4)
  5896. , unitofmeasureconvfactor numeric(15,4)
  5897. , quantityperbill numeric(15,4)
  5898. , linediscountpercent numeric(15,4)
  5899. , lineweight numeric(15,4)
  5900. , udf_primary_item varchar(1)
  5901. , valuation varchar(1)
  5902. , lotserialfullydistributed varchar(1)
  5903. , apdivisionno varchar(2)
  5904. , vendorno varchar(7)
  5905. , purchaseorderno varchar(7)
  5906. , purchaseorderrequireddate date
  5907. , commoditycode varchar(12)
  5908. , alternatetaxidentifier varchar(15)
  5909. , taxtypeapplied varchar(4)
  5910. , netgrossindicator varchar(1)
  5911. , debitcreditindicator varchar(1)
  5912. , taxamt numeric(15,4)
  5913. , taxrate numeric(15,4)
  5914. , CONSTRAINT rso_salesorderdetail_KEY0_pk PRIMARY KEY (salesorderno,linekey)
  5915. , CONSTRAINT rso_salesorderdetail_KEY0_check CHECK (salesorderno is not null and linekey IS NOT NULL)
  5916. ) WITH (OIDS=FALSE);
  5917. CREATE INDEX rso_salesorderdetail_KEY1_index ON sageimport.rso_salesorderdetail (salesorderno,lineseqno,linekey);
  5918. CREATE INDEX rso_salesorderdetail_KEY2_index ON sageimport.rso_salesorderdetail (extendeddescriptionkey,salesorderno,linekey);
  5919. CREATE INDEX rso_salesorderdetail_KEY3_index ON sageimport.rso_salesorderdetail (itemtype,itemcode,salesorderno,linekey);
  5920. CREATE INDEX rso_salesorderdetail_KEY4_index ON sageimport.rso_salesorderdetail (itemcode,warehousecode,salesorderno,linekey);
  5921. CREATE INDEX rso_salesorderdetail_KEY5_index ON sageimport.rso_salesorderdetail (apdivisionno,vendorno,salesorderno,linekey);
  5922.  
  5923.  
  5924. CREATE TABLE sageimport.rso_salesorderheader(
  5925. salesorderno varchar(7)
  5926. , orderdate date
  5927. , ordertype varchar(1)
  5928. , orderstatus varchar(1)
  5929. , masterrepeatingorderno varchar(7)
  5930. , shipexpiredate date
  5931. , ardivisionno varchar(2)
  5932. , customerno varchar(20)
  5933. , billtoname varchar(30)
  5934. , billtoaddress1 varchar(30)
  5935. , billtoaddress2 varchar(30)
  5936. , billtoaddress3 varchar(30)
  5937. , billtocity varchar(20)
  5938. , billtostate varchar(2)
  5939. , billtozipcode varchar(10)
  5940. , billtocountrycode varchar(3)
  5941. , shiptocode varchar(4)
  5942. , shiptoname varchar(30)
  5943. , shiptoaddress1 varchar(30)
  5944. , shiptoaddress2 varchar(30)
  5945. , shiptoaddress3 varchar(30)
  5946. , shiptocity varchar(20)
  5947. , shiptostate varchar(2)
  5948. , shiptozipcode varchar(10)
  5949. , shiptocountrycode varchar(3)
  5950. , shipvia varchar(15)
  5951. , shipzone varchar(5)
  5952. , shipzoneactual varchar(5)
  5953. , shipweight varchar(5)
  5954. , customerpono varchar(30)
  5955. , fob varchar(15)
  5956. , warehousecode varchar(3)
  5957. , confirmto varchar(30)
  5958. , comment varchar(30)
  5959. , termscode varchar(2)
  5960. , taxschedule varchar(9)
  5961. , taxexemptno varchar(15)
  5962. , invalidtaxcalc varchar(1)
  5963. , printsalesorders varchar(1)
  5964. , printpickingsheets varchar(1)
  5965. , lastinvoiceorderdate date
  5966. , lastinvoiceorderno varchar(7)
  5967. , currentinvoiceno varchar(7)
  5968. , checknofordeposit varchar(10)
  5969. , cyclecode varchar(2)
  5970. , faxno varchar(17)
  5971. , batchfax varchar(1)
  5972. , batchemail varchar(1)
  5973. , emailaddress varchar(250)
  5974. , freightcalculationmethod varchar(1)
  5975. , lotseriallinesexist varchar(1)
  5976. , salespersondivisionno varchar(2)
  5977. , salespersonno varchar(4)
  5978. , splitcommissions varchar(1)
  5979. , salespersondivisionno2 varchar(2)
  5980. , salespersonno2 varchar(4)
  5981. , salespersondivisionno3 varchar(2)
  5982. , salespersonno3 varchar(4)
  5983. , salespersondivisionno4 varchar(2)
  5984. , salespersonno4 varchar(4)
  5985. , salespersondivisionno5 varchar(2)
  5986. , salespersonno5 varchar(4)
  5987. , ebmusertype varchar(1)
  5988. , ebmsubmissiontype varchar(1)
  5989. , ebmuseridsubmittingthisorder varchar(15)
  5990. , paymenttype varchar(5)
  5991. , otherpaymenttyperefno varchar(24)
  5992. , cancelreasoncode varchar(5)
  5993. , paymenttypecategory varchar(1)
  5994. , rmano varchar(7)
  5995. , jobno varchar(7)
  5996. , residentialaddress varchar(1)
  5997. , crmuserid varchar(11)
  5998. , crmpersonid varchar(11)
  5999. , crmopportunityid varchar(11)
  6000. , crmcompanyid varchar(11)
  6001. , crmprospectid varchar(11)
  6002. , taxablesubjecttodiscount numeric(15,4)
  6003. , nontaxablesubjecttodiscount numeric(15,4)
  6004. , taxsubjtodiscprcntoftotsubjto numeric(15,4)
  6005. , discountrate numeric(15,4)
  6006. , discountamt numeric(15,4)
  6007. , taxableamt numeric(15,4)
  6008. , nontaxableamt numeric(15,4)
  6009. , salestaxamt numeric(15,4)
  6010. , weight numeric(15,4)
  6011. , freightamt numeric(15,4)
  6012. , depositamt numeric(15,4)
  6013. , commissionrate numeric(15,4)
  6014. , splitcommrate2 numeric(15,4)
  6015. , splitcommrate3 numeric(15,4)
  6016. , splitcommrate4 numeric(15,4)
  6017. , splitcommrate5 numeric(15,4)
  6018. , numberofshippinglabels numeric(15,4)
  6019. , lastnoofshippinglabels numeric(15,4)
  6020. , datecreated date
  6021. , timecreated varchar(8)
  6022. , usercreatedkey varchar(10)
  6023. , dateupdated date
  6024. , timeupdated varchar(8)
  6025. , userupdatedkey varchar(10)
  6026. , udf_project varchar(15)
  6027. , udf_special_info varchar(50)
  6028. , billtodivisionno varchar(2)
  6029. , billtocustomerno varchar(20)
  6030. , salesorderprinted varchar(1)
  6031. , pickingsheetprinted varchar(1)
  6032. , promoteddate date
  6033. , CONSTRAINT rso_salesorderheader_KEY0_pk PRIMARY KEY (salesorderno)
  6034. , CONSTRAINT rso_salesorderheader_KEY0_check CHECK (salesorderno IS NOT NULL)
  6035. ) WITH (OIDS=FALSE);
  6036. CREATE INDEX rso_salesorderheader_KEY1_index ON sageimport.rso_salesorderheader (ardivisionno,customerno,salesorderno);
  6037. CREATE INDEX rso_salesorderheader_KEY2_index ON sageimport.rso_salesorderheader (billtoname,salesorderno);
  6038. CREATE INDEX rso_salesorderheader_KEY3_index ON sageimport.rso_salesorderheader (customerpono,salesorderno);
  6039. CREATE INDEX rso_salesorderheader_KEY4_index ON sageimport.rso_salesorderheader (ardivisionno,customerno,customerpono,salesorderno);
  6040. CREATE INDEX rso_salesorderheader_KEY5_index ON sageimport.rso_salesorderheader (crmcompanyid,salesorderno);
  6041. CREATE INDEX rso_salesorderheader_KEY6_index ON sageimport.rso_salesorderheader (crmpersonid,salesorderno);
  6042. CREATE INDEX rso_salesorderheader_KEY7_index ON sageimport.rso_salesorderheader (crmprospectid,salesorderno);
  6043. CREATE INDEX rso_salesorderheader_KEY8_index ON sageimport.rso_salesorderheader (billtodivisionno,billtocustomerno,salesorderno);
  6044. CREATE INDEX rso_salesorderheader_KEY9_index ON sageimport.rso_salesorderheader (cancelreasoncode,salesorderno);
  6045.  
  6046.  
  6047. CREATE TABLE sageimport.rso_salesorderhistorydetail(
  6048. salesorderno varchar(7)
  6049. , sequenceno varchar(14)
  6050. , linekey varchar(6)
  6051. , originalline varchar(1)
  6052. , cancelledline varchar(1)
  6053. , cancelreasoncode varchar(5)
  6054. , itemcode varchar(30)
  6055. , itemtype varchar(1)
  6056. , itemcodedesc varchar(30)
  6057. , extendeddescriptionkey varchar(10)
  6058. , discount varchar(1)
  6059. , commissionable varchar(1)
  6060. , subjecttoexemption varchar(1)
  6061. , warehousecode varchar(3)
  6062. , pricelevel varchar(1)
  6063. , dropship varchar(1)
  6064. , printdropshipment varchar(1)
  6065. , masterorderlinekey varchar(6)
  6066. , unitofmeasure varchar(4)
  6067. , saleskitlinekey varchar(6)
  6068. , costofgoodssoldacctkey varchar(9)
  6069. , salesacctkey varchar(9)
  6070. , priceoverridden varchar(1)
  6071. , explodedkititem varchar(1)
  6072. , standardkitbill varchar(1)
  6073. , revision varchar(3)
  6074. , billoption1 varchar(2)
  6075. , billoption2 varchar(2)
  6076. , billoption3 varchar(2)
  6077. , billoption4 varchar(2)
  6078. , billoption5 varchar(2)
  6079. , billoption6 varchar(2)
  6080. , billoption7 varchar(2)
  6081. , billoption8 varchar(2)
  6082. , billoption9 varchar(2)
  6083. , backorderkitcompline varchar(1)
  6084. , skipprintcompline varchar(1)
  6085. , promisedate date
  6086. , aliasitemno varchar(30)
  6087. , taxclass varchar(2)
  6088. , customeraction varchar(1)
  6089. , itemaction varchar(1)
  6090. , warrantycode varchar(10)
  6091. , expirationdate date
  6092. , expirationoverridden varchar(1)
  6093. , costoverridden varchar(1)
  6094. , costcode varchar(9)
  6095. , costtype varchar(1)
  6096. , commenttext text
  6097. , quantityorderedoriginal numeric(15,4)
  6098. , quantityorderedrevised numeric(15,4)
  6099. , quantityshipped numeric(15,4)
  6100. , quantitybackordered numeric(15,4)
  6101. , originalunitprice numeric(15,4)
  6102. , lastunitprice numeric(15,4)
  6103. , lastextensionamt numeric(15,4)
  6104. , unitcost numeric(15,4)
  6105. , unitofmeasureconvfactor numeric(15,4)
  6106. , quantityperbill numeric(15,4)
  6107. , linediscountpercent numeric(15,4)
  6108. , lineweight numeric(15,4)
  6109. , udf_primary_item varchar(1)
  6110. , apdivisionno varchar(2)
  6111. , vendorno varchar(7)
  6112. , purchaseorderno varchar(7)
  6113. , purchaseorderrequireddate date
  6114. , commoditycode varchar(12)
  6115. , alternatetaxidentifier varchar(15)
  6116. , taxtypeapplied varchar(4)
  6117. , netgrossindicator varchar(1)
  6118. , debitcreditindicator varchar(1)
  6119. , taxamt numeric(15,4)
  6120. , taxrate numeric(15,4)
  6121. , CONSTRAINT rso_salesorderhistorydetail_KEY0_pk PRIMARY KEY (salesorderno,sequenceno)
  6122. , CONSTRAINT rso_salesorderhistorydetail_KEY0_check CHECK (salesorderno is not null and sequenceno IS NOT NULL)
  6123. ) WITH (OIDS=FALSE);
  6124. CREATE INDEX rso_salesorderhistorydetail_KEY1_index ON sageimport.rso_salesorderhistorydetail (extendeddescriptionkey,salesorderno,sequenceno);
  6125. CREATE INDEX rso_salesorderhistorydetail_KEY2_index ON sageimport.rso_salesorderhistorydetail (salesorderno,sequenceno,linekey);
  6126. CREATE INDEX rso_salesorderhistorydetail_KEY3_index ON sageimport.rso_salesorderhistorydetail (apdivisionno,vendorno,salesorderno,sequenceno);
  6127. CREATE INDEX rso_salesorderhistorydetail_KEY4_index ON sageimport.rso_salesorderhistorydetail (cancelledline,cancelreasoncode,salesorderno,sequenceno);
  6128.  
  6129.  
  6130. CREATE TABLE sageimport.rso_salesorderhistoryheader(
  6131. salesorderno varchar(7)
  6132. , orderdate date
  6133. , orderstatus varchar(1)
  6134. , masterrepeatingorderno varchar(7)
  6135. , ardivisionno varchar(2)
  6136. , customerno varchar(20)
  6137. , billtoname varchar(30)
  6138. , billtoaddress1 varchar(30)
  6139. , billtoaddress2 varchar(30)
  6140. , billtoaddress3 varchar(30)
  6141. , billtocity varchar(20)
  6142. , billtostate varchar(2)
  6143. , billtozipcode varchar(10)
  6144. , billtocountrycode varchar(3)
  6145. , shiptocode varchar(4)
  6146. , shiptoname varchar(30)
  6147. , shiptoaddress1 varchar(30)
  6148. , shiptoaddress2 varchar(30)
  6149. , shiptoaddress3 varchar(30)
  6150. , shiptocity varchar(20)
  6151. , shiptostate varchar(2)
  6152. , shiptozipcode varchar(10)
  6153. , shiptocountrycode varchar(3)
  6154. , shipvia varchar(15)
  6155. , shipzone varchar(5)
  6156. , shipzoneactual varchar(5)
  6157. , shipweight varchar(5)
  6158. , customerpono varchar(30)
  6159. , emailaddress varchar(250)
  6160. , residentialaddress varchar(1)
  6161. , cancelreasoncode varchar(5)
  6162. , freightcalculationmethod varchar(1)
  6163. , fob varchar(15)
  6164. , warehousecode varchar(3)
  6165. , confirmto varchar(30)
  6166. , comment varchar(30)
  6167. , taxschedule varchar(9)
  6168. , termscode varchar(2)
  6169. , taxexemptno varchar(15)
  6170. , rmano varchar(7)
  6171. , jobno varchar(7)
  6172. , lastinvoicedate date
  6173. , lastinvoiceno varchar(7)
  6174. , checknofordeposit varchar(10)
  6175. , lotseriallinesexist varchar(1)
  6176. , salespersondivisionno varchar(2)
  6177. , salespersonno varchar(4)
  6178. , splitcommissions varchar(1)
  6179. , salespersondivisionno2 varchar(2)
  6180. , salespersonno2 varchar(4)
  6181. , salespersondivisionno3 varchar(2)
  6182. , salespersonno3 varchar(4)
  6183. , salespersondivisionno4 varchar(2)
  6184. , salespersonno4 varchar(4)
  6185. , salespersondivisionno5 varchar(2)
  6186. , salespersonno5 varchar(4)
  6187. , ebmusertype varchar(1)
  6188. , ebmsubmissiontype varchar(1)
  6189. , ebmuseridsubmittingthisorder varchar(15)
  6190. , paymenttype varchar(5)
  6191. , otherpaymenttyperefno varchar(24)
  6192. , paymenttypecategory varchar(1)
  6193. , faxno varchar(17)
  6194. , crmuserid varchar(11)
  6195. , crmcompanyid varchar(11)
  6196. , crmpersonid varchar(11)
  6197. , crmopportunityid varchar(11)
  6198. , taxablesubjecttodiscount numeric(15,4)
  6199. , nontaxablesubjecttodiscount numeric(15,4)
  6200. , taxsubjtodiscprcnttotsubjto numeric(15,4)
  6201. , discountrate numeric(15,4)
  6202. , discountamt numeric(15,4)
  6203. , taxableamt numeric(15,4)
  6204. , nontaxableamt numeric(15,4)
  6205. , salestaxamt numeric(15,4)
  6206. , commissionrate numeric(15,4)
  6207. , splitcommrate2 numeric(15,4)
  6208. , splitcommrate3 numeric(15,4)
  6209. , splitcommrate4 numeric(15,4)
  6210. , splitcommrate5 numeric(15,4)
  6211. , weight numeric(15,4)
  6212. , freightamt numeric(15,4)
  6213. , depositamt numeric(15,4)
  6214. , datecreated date
  6215. , timecreated varchar(8)
  6216. , usercreatedkey varchar(10)
  6217. , dateupdated date
  6218. , timeupdated varchar(8)
  6219. , userupdatedkey varchar(10)
  6220. , udf_project varchar(15)
  6221. , udf_special_info varchar(50)
  6222. , billtodivisionno varchar(2)
  6223. , billtocustomerno varchar(20)
  6224. , promoteddate date
  6225. , CONSTRAINT rso_salesorderhistoryheader_KEY0_pk PRIMARY KEY (salesorderno)
  6226. , CONSTRAINT rso_salesorderhistoryheader_KEY0_check CHECK (salesorderno IS NOT NULL)
  6227. ) WITH (OIDS=FALSE);
  6228. CREATE INDEX rso_salesorderhistoryheader_KEY1_index ON sageimport.rso_salesorderhistoryheader (ardivisionno,customerno,salesorderno);
  6229. CREATE INDEX rso_salesorderhistoryheader_KEY2_index ON sageimport.rso_salesorderhistoryheader (billtoname,salesorderno);
  6230. CREATE INDEX rso_salesorderhistoryheader_KEY3_index ON sageimport.rso_salesorderhistoryheader (customerpono,salesorderno);
  6231. CREATE INDEX rso_salesorderhistoryheader_KEY4_index ON sageimport.rso_salesorderhistoryheader (ardivisionno,customerno,customerpono,salesorderno);
  6232. CREATE INDEX rso_salesorderhistoryheader_KEY5_index ON sageimport.rso_salesorderhistoryheader (orderdate,salesorderno);
  6233. CREATE INDEX rso_salesorderhistoryheader_KEY6_index ON sageimport.rso_salesorderhistoryheader (orderstatus,cancelreasoncode,salesorderno);
  6234.  
  6235.  
  6236. CREATE TABLE sageimport.rso_salesorderhistorymemo(
  6237. salesorderno varchar(7)
  6238. , memocode varchar(10)
  6239. , seqno varchar(6)
  6240. , memodesc varchar(30)
  6241. , memodate date
  6242. , expirationdate date
  6243. , reminderstartdate date
  6244. , reminderenddate date
  6245. , autodisplaysetting varchar(1)
  6246. , attachment varchar(128)
  6247. , memotext text
  6248. , originalmodulecode varchar(3)
  6249. , originalmemotype varchar(2)
  6250. , datecreated date
  6251. , timecreated varchar(8)
  6252. , usercreatedkey varchar(10)
  6253. , dateupdated date
  6254. , timeupdated varchar(8)
  6255. , userupdatedkey varchar(10)
  6256. , CONSTRAINT rso_salesorderhistorymemo_KEY0_pk PRIMARY KEY (salesorderno,memocode,seqno)
  6257. , CONSTRAINT rso_salesorderhistorymemo_KEY0_check CHECK (salesorderno is not null and memocode is not null and seqno IS NOT NULL)
  6258. ) WITH (OIDS=FALSE);
  6259. CREATE INDEX rso_salesorderhistorymemo_KEY1_index ON sageimport.rso_salesorderhistorymemo (memocode,salesorderno);
  6260.  
  6261.  
  6262. CREATE TABLE sageimport.rso_salesorderhistorypayment(
  6263. salesorderno varchar(7)
  6264. , paymentseqno varchar(6)
  6265. , paymenttype varchar(5)
  6266. , paymenttypecategory varchar(1)
  6267. , creditcardid varchar(10)
  6268. , cardtype varchar(1)
  6269. , last4unencryptedcreditcardnos varchar(4)
  6270. , last4bankroutingnos varchar(4)
  6271. , last4bankaccountnos varchar(4)
  6272. , bankname varchar(30)
  6273. , bankaccounttype varchar(1)
  6274. , expirationdateyear varchar(4)
  6275. , expirationdatemonth varchar(2)
  6276. , corporatecustidpurchorder varchar(17)
  6277. , corporatetaxoverrd varchar(1)
  6278. , cardholdername varchar(30)
  6279. , creditcardtransactionid varchar(10)
  6280. , creditcardauthorizationno varchar(16)
  6281. , authorizationdate date
  6282. , authorizationtime varchar(8)
  6283. , avsaddressline1 varchar(30)
  6284. , avsaddressline2 varchar(30)
  6285. , avscity varchar(20)
  6286. , avsstate varchar(2)
  6287. , avszipcode varchar(10)
  6288. , avscountrycode varchar(3)
  6289. , creditcardemailaddress varchar(250)
  6290. , creditcardcomment varchar(30)
  6291. , valueaddedtaxno varchar(13)
  6292. , valueaddedtaxinvoiceno varchar(15)
  6293. , transactionamt numeric(15,4)
  6294. , corporatesalestax numeric(15,4)
  6295. , valueaddedtaxtaxamt numeric(15,4)
  6296. , valueaddedtaxtaxrate numeric(15,4)
  6297. , dutyamt numeric(15,4)
  6298. , nationaltaxamt numeric(15,4)
  6299. , dateupdated date
  6300. , timeupdated varchar(8)
  6301. , userupdatedkey varchar(10)
  6302. , CONSTRAINT rso_salesorderhistorypayment_KEY0_pk PRIMARY KEY (salesorderno,paymentseqno)
  6303. , CONSTRAINT rso_salesorderhistorypayment_KEY0_check CHECK (salesorderno is not null and paymentseqno IS NOT NULL)
  6304. ) WITH (OIDS=FALSE);
  6305. CREATE INDEX rso_salesorderhistorypayment_KEY1_index ON sageimport.rso_salesorderhistorypayment (salesorderno,paymenttype,paymentseqno);
  6306. CREATE INDEX rso_salesorderhistorypayment_KEY2_index ON sageimport.rso_salesorderhistorypayment (expirationdateyear,expirationdatemonth,salesorderno,paymentseqno);
  6307.  
  6308.  
  6309. CREATE TABLE sageimport.rso_salesorderhistorytaxdetail(
  6310. salesorderno varchar(7)
  6311. , scheduleseqno varchar(6)
  6312. , taxcode varchar(15)
  6313. , taxclass varchar(2)
  6314. , taxablesalesamt numeric(15,4)
  6315. , nontaxablesalesamt numeric(15,4)
  6316. , exemptsalesamt numeric(15,4)
  6317. , taxablesalessubjtodisc numeric(15,4)
  6318. , nontaxablesalessubjtodisc numeric(15,4)
  6319. , taxrate numeric(15,4)
  6320. , discountamt numeric(15,4)
  6321. , dateupdated date
  6322. , timeupdated varchar(8)
  6323. , userupdatedkey varchar(10)
  6324. , CONSTRAINT rso_salesorderhistorytaxdetail_KEY0_pk PRIMARY KEY (salesorderno,scheduleseqno,taxcode,taxclass)
  6325. , CONSTRAINT rso_salesorderhistorytaxdetail_KEY0_check CHECK (salesorderno is not null and scheduleseqno is not null and taxcode is not null and taxclass IS NOT NULL)
  6326. ) WITH (OIDS=FALSE);
  6327.  
  6328.  
  6329. CREATE TABLE sageimport.rso_salesorderhistorytaxsummary(
  6330. salesorderno varchar(7)
  6331. , scheduleseqno varchar(6)
  6332. , taxcode varchar(15)
  6333. , exemptionno varchar(20)
  6334. , overridden varchar(1)
  6335. , taxablesalesamt numeric(15,4)
  6336. , nontaxablesalesamt numeric(15,4)
  6337. , exemptsalesamt numeric(15,4)
  6338. , taxablefreightamt numeric(15,4)
  6339. , taxabletaxamt numeric(15,4)
  6340. , salestaxamt numeric(15,4)
  6341. , nontaxablefreightamt numeric(15,4)
  6342. , dateupdated date
  6343. , timeupdated varchar(8)
  6344. , userupdatedkey varchar(10)
  6345. , CONSTRAINT rso_salesorderhistorytaxsummary_KEY0_pk PRIMARY KEY (salesorderno,scheduleseqno,taxcode)
  6346. , CONSTRAINT rso_salesorderhistorytaxsummary_KEY0_check CHECK (salesorderno is not null and scheduleseqno is not null and taxcode IS NOT NULL)
  6347. ) WITH (OIDS=FALSE);
  6348.  
  6349.  
  6350. CREATE TABLE sageimport.rso_salesorderprint(
  6351. printtype varchar(1)
  6352. , salesorderno varchar(7)
  6353. , warehousecode varchar(3)
  6354. , jobno varchar(7)
  6355. , invoiceno varchar(7)
  6356. , CONSTRAINT rso_salesorderprint_KEY0_pk PRIMARY KEY (printtype,salesorderno)
  6357. , CONSTRAINT rso_salesorderprint_KEY0_check CHECK (printtype is not null and salesorderno IS NOT NULL)
  6358. ) WITH (OIDS=FALSE);
  6359.  
  6360.  
  6361. CREATE TABLE sageimport.rso_salesorderrecap(
  6362. salesorderno varchar(7)
  6363. , orderdate date
  6364. , ordertype varchar(1)
  6365. , ardivisionno varchar(2)
  6366. , customerno varchar(20)
  6367. , billtoname varchar(30)
  6368. , orderstatus varchar(1)
  6369. , shipexpiredate date
  6370. , comment varchar(30)
  6371. , lastinvoiceorderdate date
  6372. , lastinvoiceorderno varchar(7)
  6373. , rmano varchar(7)
  6374. , crmcompanyid varchar(11)
  6375. , crmcompanyname varchar(40)
  6376. , ordertotal numeric(15,4)
  6377. , dateupdated date
  6378. , timeupdated varchar(8)
  6379. , userupdatedkey varchar(10)
  6380. , billtodivisionno varchar(2)
  6381. , billtocustomerno varchar(20)
  6382. , CONSTRAINT rso_salesorderrecap_KEY0_pk PRIMARY KEY (salesorderno)
  6383. , CONSTRAINT rso_salesorderrecap_KEY0_check CHECK (salesorderno IS NOT NULL)
  6384. ) WITH (OIDS=FALSE);
  6385.  
  6386.  
  6387. CREATE TABLE sageimport.rso_salesordertaxdetail(
  6388. salesorderno varchar(7)
  6389. , scheduleseqno varchar(6)
  6390. , taxcode varchar(15)
  6391. , taxclass varchar(2)
  6392. , taxablesalesamt numeric(15,4)
  6393. , nontaxablesalesamt numeric(15,4)
  6394. , exemptsalesamt numeric(15,4)
  6395. , taxablesalessubjtodisc numeric(15,4)
  6396. , nontaxablesalessubjtodisc numeric(15,4)
  6397. , taxrate numeric(15,4)
  6398. , discountamt numeric(15,4)
  6399. , CONSTRAINT rso_salesordertaxdetail_KEY0_pk PRIMARY KEY (salesorderno,scheduleseqno,taxcode,taxclass)
  6400. , CONSTRAINT rso_salesordertaxdetail_KEY0_check CHECK (salesorderno is not null and scheduleseqno is not null and taxcode is not null and taxclass IS NOT NULL)
  6401. ) WITH (OIDS=FALSE);
  6402.  
  6403.  
  6404. CREATE TABLE sageimport.rso_salesordertaxsummary(
  6405. salesorderno varchar(7)
  6406. , scheduleseqno varchar(6)
  6407. , taxcode varchar(15)
  6408. , exemptionno varchar(20)
  6409. , overridden varchar(1)
  6410. , taxablesalesamt numeric(15,4)
  6411. , nontaxablesalesamt numeric(15,4)
  6412. , exemptsalesamt numeric(15,4)
  6413. , taxablefreightamt numeric(15,4)
  6414. , nontaxablefreightamt numeric(15,4)
  6415. , taxabletaxamt numeric(15,4)
  6416. , salestaxamt numeric(15,4)
  6417. , CONSTRAINT rso_salesordertaxsummary_KEY0_pk PRIMARY KEY (salesorderno,scheduleseqno,taxcode)
  6418. , CONSTRAINT rso_salesordertaxsummary_KEY0_check CHECK (salesorderno is not null and scheduleseqno is not null and taxcode IS NOT NULL)
  6419. ) WITH (OIDS=FALSE);
  6420.  
  6421.  
  6422. CREATE TABLE sageimport.rso_shippingoptions(
  6423. modulecode varchar(3)
  6424. , promptforbackorder varchar(1)
  6425. , displayinvoicetotal varchar(1)
  6426. , defaultshipperid varchar(1)
  6427. , shippingdocumenttoprint varchar(1)
  6428. , printadditionalpackinglists varchar(1)
  6429. , printshippingexcptnrpt varchar(1)
  6430. , automaticallyprintshippingdocs varchar(1)
  6431. , automaticallyincrementqty varchar(1)
  6432. , autoincrementkeyword varchar(15)
  6433. , nextpackagekeyword varchar(15)
  6434. , shippingfunction varchar(1)
  6435. , allowalternateitems varchar(1)
  6436. , allowovershipment varchar(1)
  6437. , allowchangestowhse varchar(1)
  6438. , allowchangestoum varchar(1)
  6439. , allowchangestoshipto varchar(1)
  6440. , allowchangestoshipvia varchar(1)
  6441. , allowchangestobackorderqty varchar(1)
  6442. , allowentryoffrghtwght varchar(1)
  6443. , allowcommentsonitemlines varchar(1)
  6444. , ordertodisplaylines varchar(1)
  6445. , shippingintegration varchar(1)
  6446. , addfreighttocod varchar(1)
  6447. , billingmethod varchar(1)
  6448. , defaultdeclaredvalue varchar(1)
  6449. , freighttoinvoicefrght varchar(1)
  6450. , returnfocustoitemcode varchar(1)
  6451. , fixeddeclaredvalue numeric(15,4)
  6452. , cogsmarkuppercent numeric(15,4)
  6453. , dateupdated date
  6454. , timeupdated varchar(8)
  6455. , userupdatedkey varchar(10)
  6456. , CONSTRAINT rso_shippingoptions_KEY0_pk PRIMARY KEY (modulecode)
  6457. , CONSTRAINT rso_shippingoptions_KEY0_check CHECK (modulecode IS NOT NULL)
  6458. ) WITH (OIDS=FALSE);
  6459.  
  6460.  
  6461. CREATE TABLE sageimport.rso_shippingrateheader(
  6462. shippingcode varchar(15)
  6463. , shippingcodedesc varchar(30)
  6464. , freightcalculationmethod varchar(1)
  6465. , useshipzone varchar(1)
  6466. , usezipcodeasshipzone varchar(1)
  6467. , usepriorrangeofzipcodes varchar(1)
  6468. , weightcalculation varchar(1)
  6469. , linetype varchar(1)
  6470. , ebmenabled varchar(1)
  6471. , baseamt numeric(15,4)
  6472. , datecreated date
  6473. , timecreated varchar(8)
  6474. , usercreatedkey varchar(10)
  6475. , dateupdated date
  6476. , timeupdated varchar(8)
  6477. , userupdatedkey varchar(10)
  6478. , CONSTRAINT rso_shippingrateheader_KEY0_pk PRIMARY KEY (shippingcode)
  6479. , CONSTRAINT rso_shippingrateheader_KEY0_check CHECK (shippingcode IS NOT NULL)
  6480. ) WITH (OIDS=FALSE);
  6481.  
  6482.  
  6483. CREATE TABLE sageimport.rso_shiptoaddress(
  6484. ardivisionno varchar(2)
  6485. , customerno varchar(20)
  6486. , shiptocode varchar(4)
  6487. , shiptoname varchar(30)
  6488. , shiptoaddress1 varchar(30)
  6489. , shiptoaddress2 varchar(30)
  6490. , shiptoaddress3 varchar(30)
  6491. , shiptocity varchar(20)
  6492. , shiptostate varchar(2)
  6493. , shiptozipcode varchar(10)
  6494. , shiptocountrycode varchar(3)
  6495. , telephoneno varchar(17)
  6496. , telephoneext varchar(5)
  6497. , faxno varchar(17)
  6498. , batchfax varchar(1)
  6499. , batchemail varchar(1)
  6500. , emailaddress varchar(50)
  6501. , contactcode varchar(10)
  6502. , salespersondivisionno varchar(2)
  6503. , salespersonno varchar(4)
  6504. , warehousecode varchar(3)
  6505. , taxschedule varchar(9)
  6506. , residentialaddress varchar(1)
  6507. , datecreated date
  6508. , timecreated varchar(8)
  6509. , usercreatedkey varchar(10)
  6510. , dateupdated date
  6511. , timeupdated varchar(8)
  6512. , userupdatedkey varchar(10)
  6513. , shipvia varchar(15)
  6514. , CONSTRAINT rso_shiptoaddress_KEY0_pk PRIMARY KEY (ardivisionno,customerno,shiptocode)
  6515. , CONSTRAINT rso_shiptoaddress_KEY0_check CHECK (ardivisionno is not null and customerno is not null and shiptocode IS NOT NULL)
  6516. ) WITH (OIDS=FALSE);
  6517. CREATE INDEX rso_shiptoaddress_KEY1_index ON sageimport.rso_shiptoaddress (shiptoaddress1,ardivisionno,customerno,shiptocode);
  6518. CREATE INDEX rso_shiptoaddress_KEY2_index ON sageimport.rso_shiptoaddress (shiptoaddress2,ardivisionno,customerno,shiptocode);
  6519. CREATE INDEX rso_shiptoaddress_KEY3_index ON sageimport.rso_shiptoaddress (shiptoaddress3,ardivisionno,customerno,shiptocode);
  6520. CREATE INDEX rso_shiptoaddress_KEY4_index ON sageimport.rso_shiptoaddress (shiptozipcode,ardivisionno,customerno,shiptocode);
  6521.  
  6522.  
  6523. CREATE TABLE sageimport.rsy_1099setup(
  6524. formtype1099 varchar(1)
  6525. , calendaryr varchar(4)
  6526. , boxid varchar(3)
  6527. , boxdesc varchar(50)
  6528. , textdata varchar(1)
  6529. , printonform varchar(1)
  6530. , CONSTRAINT rsy_1099setup_KEY0_pk PRIMARY KEY (formtype1099,calendaryr,boxid)
  6531. , CONSTRAINT rsy_1099setup_KEY0_check CHECK (formtype1099 is not null and calendaryr is not null and boxid IS NOT NULL)
  6532. ) WITH (OIDS=FALSE);
  6533. CREATE INDEX rsy_1099setup_KEY1_index ON sageimport.rsy_1099setup (calendaryr,formtype1099,boxid);
  6534. CREATE INDEX rsy_1099setup_KEY2_index ON sageimport.rsy_1099setup (textdata,formtype1099,calendaryr,boxid);
  6535.  
  6536.  
  6537. CREATE TABLE sageimport.rsy_activation(
  6538. modulecode varchar(3)
  6539. , developercode varchar(3)
  6540. , companykey varchar(10)
  6541. , datalevel numeric(15,4)
  6542. , sublevel numeric(15,4)
  6543. , CONSTRAINT rsy_activation_KEY0_pk PRIMARY KEY (companykey,modulecode)
  6544. , CONSTRAINT rsy_activation_KEY0_check CHECK (companykey is not null and modulecode IS NOT NULL)
  6545. ) WITH (OIDS=FALSE);
  6546.  
  6547.  
  6548. CREATE TABLE sageimport.rsy_activationreq(
  6549. modulecode varchar(3)
  6550. , developercode varchar(3)
  6551. , requiredmodulecode varchar(3)
  6552. , requireddevelopercode varchar(3)
  6553. , CONSTRAINT rsy_activationreq_KEY0_pk PRIMARY KEY (modulecode,requiredmodulecode)
  6554. , CONSTRAINT rsy_activationreq_KEY0_check CHECK (modulecode is not null and requiredmodulecode IS NOT NULL)
  6555. ) WITH (OIDS=FALSE);
  6556.  
  6557.  
  6558. CREATE TABLE sageimport.rsy_activitytype(
  6559. activitytype varchar(2)
  6560. , activitygroup varchar(30)
  6561. , activitydesc varchar(40)
  6562. , modulecode varchar(3)
  6563. , CONSTRAINT rsy_activitytype_KEY0_pk PRIMARY KEY (activitytype)
  6564. , CONSTRAINT rsy_activitytype_KEY0_check CHECK (activitytype IS NOT NULL)
  6565. ) WITH (OIDS=FALSE);
  6566.  
  6567.  
  6568. CREATE TABLE sageimport.rsy_baseodbcsecurity(
  6569. modulecode varchar(3)
  6570. , tablename varchar(40)
  6571. , fieldname varchar(40)
  6572. , sequenceno varchar(12)
  6573. , CONSTRAINT rsy_baseodbcsecurity_KEY0_pk PRIMARY KEY (modulecode,tablename,fieldname)
  6574. , CONSTRAINT rsy_baseodbcsecurity_KEY0_check CHECK (modulecode is not null and tablename is not null and fieldname IS NOT NULL)
  6575. , CONSTRAINT rsy_baseodbcsecurity_KEY1_unique UNIQUE (modulecode,tablename,sequenceno)
  6576. ) WITH (OIDS=FALSE);
  6577.  
  6578.  
  6579. CREATE TABLE sageimport.rsy_batchmanager(
  6580. modulecode varchar(3)
  6581. , batchtype varchar(2)
  6582. , batchdesc varchar(30)
  6583. , dataentrytablename varchar(30)
  6584. , restarttablename varchar(30)
  6585. , keyexpression varchar(80)
  6586. , businessobject varchar(40)
  6587. , updateuitaskkey varchar(9)
  6588. , totalheading01 varchar(20)
  6589. , totalheading02 varchar(20)
  6590. , totalheading03 varchar(20)
  6591. , totalheading04 varchar(20)
  6592. , totalheading05 varchar(20)
  6593. , totalheading06 varchar(20)
  6594. , totalheading07 varchar(20)
  6595. , totalheading08 varchar(20)
  6596. , totalheading09 varchar(20)
  6597. , totalheading10 varchar(20)
  6598. , totalcolumnsused numeric(15,4)
  6599. , CONSTRAINT rsy_batchmanager_KEY0_pk PRIMARY KEY (modulecode,batchtype)
  6600. , CONSTRAINT rsy_batchmanager_KEY0_check CHECK (modulecode is not null and batchtype IS NOT NULL)
  6601. ) WITH (OIDS=FALSE);
  6602. CREATE INDEX rsy_batchmanager_KEY1_index ON sageimport.rsy_batchmanager (updateuitaskkey);
  6603.  
  6604.  
  6605. CREATE TABLE sageimport.rsy_company(
  6606. companykey varchar(10)
  6607. , companycode varchar(3)
  6608. , companyname varchar(50)
  6609. , address1 varchar(35)
  6610. , address2 varchar(35)
  6611. , address3 varchar(35)
  6612. , address4 varchar(35)
  6613. , phone varchar(17)
  6614. , fax varchar(17)
  6615. , companyurl varchar(64)
  6616. , federalid varchar(15)
  6617. , stateid varchar(15)
  6618. , alternatedirectory varchar(128)
  6619. , alternatepayrolldirectory varchar(128)
  6620. , externalaccess varchar(1)
  6621. , autosetdate varchar(1)
  6622. , promptfordate varchar(1)
  6623. , restrictdate varchar(1)
  6624. , printuserlogon varchar(1)
  6625. , useworkstationdfltpntrstdrpt varchar(1)
  6626. , useworkstationdfltpntrstdform varchar(1)
  6627. , prefsdefaultcompany varchar(1)
  6628. , allcapscity varchar(1)
  6629. , creditcardenable varchar(1)
  6630. , creditcardlog varchar(1)
  6631. , creditcarddisplay varchar(1)
  6632. , creditcardtranstimeout numeric(15,4)
  6633. , creditcardbatchauthtrans varchar(1)
  6634. , webreportsservername varchar(50)
  6635. , webreportsaliasdirectory varchar(128)
  6636. , webreportsdefaultsettings varchar(1)
  6637. , companylevel numeric(15,4)
  6638. , smtpserveraddressurl varchar(50)
  6639. , smtpserverport numeric(15,4)
  6640. , emailuserid varchar(30)
  6641. , emailuseridpassword varchar(129)
  6642. , emaillogindomain varchar(128)
  6643. , use128bitencryption varchar(1)
  6644. , usepdflockfile varchar(1)
  6645. , autoinstallpdfconverter varchar(1)
  6646. , emailaddress varchar(50)
  6647. , defaultfaxprinter varchar(100)
  6648. , faxcoverpage varchar(210)
  6649. , tradename varchar(35)
  6650. , enablewebservicesforcompany varchar(1)
  6651. , displayinactivecustomersinale varchar(1)
  6652. , displayinactivevendorsinale varchar(1)
  6653. , creditcardvaultonlyid varchar(13)
  6654. , creditcardvaultonlykey varchar(13)
  6655. , smtpencryption varchar(1)
  6656. , aesencryptionkey varchar(96)
  6657. , enablebackgroundcolor varchar(1)
  6658. , backgroundrgbred numeric(15,4)
  6659. , backgroundrgbgreen numeric(15,4)
  6660. , backgroundrgbblue numeric(15,4)
  6661. , companyversion varchar(11)
  6662. , themecode varchar(20)
  6663. , CONSTRAINT rsy_company_KEY0_pk PRIMARY KEY (companykey)
  6664. , CONSTRAINT rsy_company_KEY0_check CHECK (companykey IS NOT NULL)
  6665. , CONSTRAINT rsy_company_KEY1_unique UNIQUE (companycode)
  6666. ) WITH (OIDS=FALSE);
  6667.  
  6668.  
  6669. CREATE TABLE sageimport.rsy_console(
  6670. workstationname varchar(30)
  6671. , sessioncounter varchar(3)
  6672. , taskkey varchar(9)
  6673. , userkey varchar(10)
  6674. , modulecode varchar(3)
  6675. , programname varchar(30)
  6676. , companycode varchar(3)
  6677. , companykey varchar(10)
  6678. , launcherhwnd numeric(15,4)
  6679. , sessionhwnd numeric(15,4)
  6680. , clienthwnd numeric(15,4)
  6681. , sessionpid numeric(15,4)
  6682. , CONSTRAINT rsy_console_KEY0_pk PRIMARY KEY (workstationname,sessioncounter)
  6683. , CONSTRAINT rsy_console_KEY0_check CHECK (workstationname is not null and sessioncounter IS NOT NULL)
  6684. ) WITH (OIDS=FALSE);
  6685.  
  6686.  
  6687. CREATE TABLE sageimport.rsy_conversiondriver(
  6688. version varchar(11)
  6689. , conversiontype varchar(30)
  6690. , tablename varchar(50)
  6691. , conversionid varchar(6)
  6692. , developercode varchar(3)
  6693. , modulecode varchar(3)
  6694. , moduleconversionorder varchar(5)
  6695. , executionorder varchar(14)
  6696. , columnname varchar(50)
  6697. , referencekey varchar(150)
  6698. , ignorerecord varchar(1)
  6699. , conversionlogic text
  6700. , columnvalue text
  6701. , columncondition text
  6702. , selectwhereclause text
  6703. , conversionnotes text
  6704. , enhancementcode varchar(140)
  6705. , sagedesignation varchar(140)
  6706. , datecreated date
  6707. , timecreated varchar(8)
  6708. , workstationcreated varchar(30)
  6709. , dateupdated date
  6710. , timeupdated varchar(8)
  6711. , workstationupdated varchar(30)
  6712. , CONSTRAINT rsy_conversiondriver_KEY0_pk PRIMARY KEY (version,conversiontype,tablename,conversionid,developercode)
  6713. , CONSTRAINT rsy_conversiondriver_KEY0_check CHECK (version is not null and conversiontype is not null and tablename is not null and conversionid is not null and developercode IS NOT NULL)
  6714. ) WITH (OIDS=FALSE);
  6715. CREATE INDEX rsy_conversiondriver_KEY1_index ON sageimport.rsy_conversiondriver (modulecode,version,conversiontype,tablename,conversionid,developercode);
  6716. CREATE INDEX rsy_conversiondriver_KEY2_index ON sageimport.rsy_conversiondriver (conversiontype,version,moduleconversionorder,modulecode,executionorder,tablename,conversionid,developercode);
  6717. CREATE INDEX rsy_conversiondriver_KEY3_index ON sageimport.rsy_conversiondriver (conversiontype,version,tablename,executionorder,conversionid,developercode);
  6718. CREATE INDEX rsy_conversiondriver_KEY4_index ON sageimport.rsy_conversiondriver (conversiontype,tablename,version,conversionid,developercode);
  6719.  
  6720.  
  6721. CREATE TABLE sageimport.rsy_conversionhistory(
  6722. version varchar(11)
  6723. , conversiontype varchar(30)
  6724. , tablename varchar(50)
  6725. , conversionid varchar(6)
  6726. , developercode varchar(3)
  6727. , conversionnotes text
  6728. , ignorerecord varchar(1)
  6729. , datecreated date
  6730. , timecreated varchar(8)
  6731. , usercreatedkey varchar(10)
  6732. , CONSTRAINT rsy_conversionhistory_KEY0_pk PRIMARY KEY (version,conversiontype,tablename,conversionid,developercode)
  6733. , CONSTRAINT rsy_conversionhistory_KEY0_check CHECK (version is not null and conversiontype is not null and tablename is not null and conversionid is not null and developercode IS NOT NULL)
  6734. ) WITH (OIDS=FALSE);
  6735.  
  6736.  
  6737. CREATE TABLE sageimport.rsy_country(
  6738. countrycode varchar(3)
  6739. , countryname varchar(30)
  6740. , phonecode varchar(3)
  6741. , alternatecountrycode varchar(2)
  6742. , isocountrycode varchar(3)
  6743. , statecoderequired varchar(1)
  6744. , CONSTRAINT rsy_country_KEY0_pk PRIMARY KEY (countrycode)
  6745. , CONSTRAINT rsy_country_KEY0_check CHECK (countrycode IS NOT NULL)
  6746. ) WITH (OIDS=FALSE);
  6747. CREATE INDEX rsy_country_KEY1_index ON sageimport.rsy_country (countryname);
  6748. CREATE INDEX rsy_country_KEY2_index ON sageimport.rsy_country (alternatecountrycode);
  6749.  
  6750.  
  6751. CREATE TABLE sageimport.rsy_deferred(
  6752. modulecode varchar(3)
  6753. , userlogon varchar(60)
  6754. , companycode varchar(3)
  6755. , filename varchar(12)
  6756. , title varchar(48)
  6757. , datecreated date
  6758. , timecreated varchar(10)
  6759. , printername varchar(100)
  6760. , copies numeric(15,4)
  6761. , totalpages numeric(15,4)
  6762. , pagefrom numeric(15,4)
  6763. , pagethru numeric(15,4)
  6764. , ccollate varchar(1)
  6765. , secured varchar(1)
  6766. , purgeafterprinting varchar(1)
  6767. , purgeafterprintingorigcopy varchar(1)
  6768. , auditregister varchar(1)
  6769. , CONSTRAINT rsy_deferred_KEY0_pk PRIMARY KEY (modulecode,userlogon,companycode,filename)
  6770. , CONSTRAINT rsy_deferred_KEY0_check CHECK (modulecode is not null and userlogon is not null and companycode is not null and filename IS NOT NULL)
  6771. ) WITH (OIDS=FALSE);
  6772. CREATE INDEX rsy_deferred_KEY1_index ON sageimport.rsy_deferred (userlogon,modulecode,companycode,filename);
  6773.  
  6774.  
  6775. CREATE TABLE sageimport.rsy_developer(
  6776. developercode varchar(3)
  6777. , developername varchar(50)
  6778. , CONSTRAINT rsy_developer_KEY0_pk PRIMARY KEY (developercode)
  6779. , CONSTRAINT rsy_developer_KEY0_check CHECK (developercode IS NOT NULL)
  6780. ) WITH (OIDS=FALSE);
  6781.  
  6782.  
  6783. CREATE TABLE sageimport.rsy_dictionaryconversionhist(
  6784. version varchar(11)
  6785. , conversiontype varchar(30)
  6786. , tablename varchar(50)
  6787. , conversionid varchar(6)
  6788. , developercode varchar(3)
  6789. , conversionnotes text
  6790. , ignorerecord varchar(1)
  6791. , datecreated date
  6792. , timecreated varchar(8)
  6793. , usercreatedkey varchar(10)
  6794. , CONSTRAINT rsy_dictionaryconversionhist_KEY0_pk PRIMARY KEY (version,conversiontype,tablename,conversionid,developercode)
  6795. , CONSTRAINT rsy_dictionaryconversionhist_KEY0_check CHECK (version is not null and conversiontype is not null and tablename is not null and conversionid is not null and developercode IS NOT NULL)
  6796. ) WITH (OIDS=FALSE);
  6797.  
  6798.  
  6799. CREATE TABLE sageimport.rsy_eisviewmaster(
  6800. developercode varchar(3)
  6801. , modulecode varchar(3)
  6802. , viewid varchar(3)
  6803. , viewdescription varchar(40)
  6804. , viewtemplate varchar(50)
  6805. , viewsize varchar(1)
  6806. , viewvalidation varchar(100)
  6807. , optionname1 varchar(30)
  6808. , optiontype1 varchar(1)
  6809. , optionvalidation1 text
  6810. , optiondefaultvalue1 text
  6811. , optionname2 varchar(30)
  6812. , optiontype2 varchar(1)
  6813. , optionvalidation2 text
  6814. , optiondefaultvalue2 text
  6815. , linkdescription1 varchar(100)
  6816. , linktype1 varchar(1)
  6817. , linkvalue1 text
  6818. , linkdescription2 varchar(100)
  6819. , linktype2 varchar(1)
  6820. , linkvalue2 text
  6821. , linkdescription3 varchar(100)
  6822. , linktype3 varchar(1)
  6823. , linkvalue3 text
  6824. , linkdescription4 varchar(100)
  6825. , linktype4 varchar(1)
  6826. , linkvalue4 text
  6827. , linkdescription5 varchar(100)
  6828. , linktype5 varchar(1)
  6829. , linkvalue5 text
  6830. , numberofoptions numeric(15,4)
  6831. , numberoflinks numeric(15,4)
  6832. , CONSTRAINT rsy_eisviewmaster_KEY0_pk PRIMARY KEY (developercode,modulecode,viewid)
  6833. , CONSTRAINT rsy_eisviewmaster_KEY0_check CHECK (developercode is not null and modulecode is not null and viewid IS NOT NULL)
  6834. ) WITH (OIDS=FALSE);
  6835. CREATE INDEX rsy_eisviewmaster_KEY1_index ON sageimport.rsy_eisviewmaster (viewtemplate,developercode,modulecode,viewid);
  6836.  
  6837.  
  6838. CREATE TABLE sageimport.rsy_embeddediosettings(
  6839. filename varchar(30)
  6840. , subkey varchar(10)
  6841. , setting text
  6842. , CONSTRAINT rsy_embeddediosettings_KEY0_pk PRIMARY KEY (filename,subkey)
  6843. , CONSTRAINT rsy_embeddediosettings_KEY0_check CHECK (filename is not null and subkey IS NOT NULL)
  6844. ) WITH (OIDS=FALSE);
  6845.  
  6846.  
  6847. CREATE TABLE sageimport.rsy_exportlink(
  6848. primarytable varchar(30)
  6849. , linktable varchar(30)
  6850. , sequenceno varchar(2)
  6851. , userdefined varchar(1)
  6852. , primarykeyexpression text
  6853. , modulecode varchar(3)
  6854. , secondarylinktable varchar(30)
  6855. , secondarykeyexpr text
  6856. , CONSTRAINT rsy_exportlink_KEY0_pk PRIMARY KEY (primarytable,linktable,sequenceno)
  6857. , CONSTRAINT rsy_exportlink_KEY0_check CHECK (primarytable is not null and linktable is not null and sequenceno IS NOT NULL)
  6858. ) WITH (OIDS=FALSE);
  6859.  
  6860.  
  6861. CREATE TABLE sageimport.rsy_fieldmapping(
  6862. crmtable varchar(30)
  6863. , crmfield varchar(30)
  6864. , mastable varchar(30)
  6865. , masfield varchar(30)
  6866. , specialformatting varchar(1)
  6867. , modulecode varchar(3)
  6868. , CONSTRAINT rsy_fieldmapping_KEY0_pk PRIMARY KEY (crmtable,mastable,crmfield)
  6869. , CONSTRAINT rsy_fieldmapping_KEY0_check CHECK (crmtable is not null and mastable is not null and crmfield IS NOT NULL)
  6870. ) WITH (OIDS=FALSE);
  6871. CREATE INDEX rsy_fieldmapping_KEY1_index ON sageimport.rsy_fieldmapping (mastable,crmtable,masfield);
  6872.  
  6873.  
  6874. CREATE TABLE sageimport.rsy_financialreport(
  6875. reportname varchar(30)
  6876. , reporttitle varchar(50)
  6877. , reporttype varchar(1)
  6878. , reportgroup varchar(20)
  6879. , summarytype varchar(1)
  6880. , columnformat varchar(1)
  6881. , reportperiod varchar(1)
  6882. , trendperiodtype varchar(1)
  6883. , trendfollowingperiod numeric(15,4)
  6884. , trendfirstperiod varchar(1)
  6885. , trendlastperiod varchar(1)
  6886. , budgetcode varchar(10)
  6887. , decimalplaces varchar(1)
  6888. , decimalseparator varchar(1)
  6889. , negativevalueformat varchar(1)
  6890. , thousandseparator varchar(1)
  6891. , percentdecimalplaces varchar(1)
  6892. , percentsymbol varchar(1)
  6893. , roundingfactor varchar(1)
  6894. , printaccountno varchar(1)
  6895. , dollarsigntype varchar(1)
  6896. , printzeroacct varchar(1)
  6897. , liabilitynewpage varchar(1)
  6898. , useruntimeacctsel varchar(1)
  6899. , usecondensedformat varchar(1)
  6900. , useruntimetrendopt varchar(1)
  6901. , footnoteoption varchar(1)
  6902. , centerfootnote varchar(1)
  6903. , useruntimefootnote varchar(1)
  6904. , permanentrecord varchar(1)
  6905. , printuserkey varchar(10)
  6906. , footnotetext text
  6907. , firstamountonly varchar(1)
  6908. , CONSTRAINT rsy_financialreport_KEY0_pk PRIMARY KEY (reportname)
  6909. , CONSTRAINT rsy_financialreport_KEY0_check CHECK (reportname IS NOT NULL)
  6910. ) WITH (OIDS=FALSE);
  6911. CREATE INDEX rsy_financialreport_KEY1_index ON sageimport.rsy_financialreport (reportgroup,reportname);
  6912.  
  6913.  
  6914. CREATE TABLE sageimport.rsy_financialreportcolumn(
  6915. reporttype varchar(1)
  6916. , columnformat varchar(1)
  6917. , reportperiod varchar(1)
  6918. , templateid varchar(30)
  6919. , column1title1 varchar(100)
  6920. , column1title2 varchar(100)
  6921. , column1data varchar(100)
  6922. , column1calcformula varchar(100)
  6923. , column2title1 varchar(100)
  6924. , column2title2 varchar(100)
  6925. , column2data varchar(100)
  6926. , column2calcformula varchar(100)
  6927. , column3title1 varchar(100)
  6928. , column3title2 varchar(100)
  6929. , column3data varchar(100)
  6930. , column3calcformula varchar(100)
  6931. , column4title1 varchar(100)
  6932. , column4title2 varchar(100)
  6933. , column4data varchar(100)
  6934. , column4calcformula varchar(100)
  6935. , column5title1 varchar(100)
  6936. , column5title2 varchar(100)
  6937. , column5data varchar(100)
  6938. , column5calcformula varchar(100)
  6939. , column6title1 varchar(100)
  6940. , column6title2 varchar(100)
  6941. , column6data varchar(100)
  6942. , column6calcformula varchar(100)
  6943. , column7title1 varchar(100)
  6944. , column7title2 varchar(100)
  6945. , column7data varchar(100)
  6946. , column7calcformula varchar(100)
  6947. , column8title1 varchar(100)
  6948. , column8title2 varchar(100)
  6949. , column8data varchar(100)
  6950. , column8calcformula varchar(100)
  6951. , column9title1 varchar(100)
  6952. , column9title2 varchar(100)
  6953. , column9data varchar(100)
  6954. , column9calcformula varchar(100)
  6955. , column10title1 varchar(100)
  6956. , column10title2 varchar(100)
  6957. , column10data varchar(100)
  6958. , column10calcformula varchar(100)
  6959. , column11title1 varchar(100)
  6960. , column11title2 varchar(100)
  6961. , column11data varchar(100)
  6962. , column11calcformula varchar(100)
  6963. , column12title1 varchar(100)
  6964. , column12title2 varchar(100)
  6965. , column12data varchar(100)
  6966. , column12calcformula varchar(100)
  6967. , column13title1 varchar(100)
  6968. , column13title2 varchar(100)
  6969. , column13data varchar(100)
  6970. , column13calcformula varchar(100)
  6971. , column14title1 varchar(100)
  6972. , column14title2 varchar(100)
  6973. , column14data varchar(100)
  6974. , column14calcformula varchar(100)
  6975. , CONSTRAINT rsy_financialreportcolumn_KEY0_pk PRIMARY KEY (reporttype,columnformat,reportperiod)
  6976. , CONSTRAINT rsy_financialreportcolumn_KEY0_check CHECK (reporttype is not null and columnformat is not null and reportperiod IS NOT NULL)
  6977. ) WITH (OIDS=FALSE);
  6978.  
  6979.  
  6980. CREATE TABLE sageimport.rsy_financialterminology(
  6981. financialtermcode varchar(6)
  6982. , financialtermdefaultdesc varchar(40)
  6983. , CONSTRAINT rsy_financialterminology_KEY0_pk PRIMARY KEY (financialtermcode)
  6984. , CONSTRAINT rsy_financialterminology_KEY0_check CHECK (financialtermcode IS NOT NULL)
  6985. ) WITH (OIDS=FALSE);
  6986.  
  6987.  
  6988. CREATE TABLE sageimport.rsy_formsefilingversion(
  6989. modulecode varchar(3)
  6990. , aatrixversion varchar(10)
  6991. , sourcevendor varchar(50)
  6992. , sourceprogram varchar(30)
  6993. , registrationurl text
  6994. , username varchar(20)
  6995. , password varchar(21)
  6996. , lastregistrationdate varchar(9)
  6997. , proxyaddress text
  6998. , proxyusername varchar(64)
  6999. , proxypassword varchar(64)
  7000. , CONSTRAINT rsy_formsefilingversion_KEY0_pk PRIMARY KEY (modulecode)
  7001. , CONSTRAINT rsy_formsefilingversion_KEY0_check CHECK (modulecode IS NOT NULL)
  7002. ) WITH (OIDS=FALSE);
  7003.  
  7004.  
  7005. CREATE TABLE sageimport.rsy_griddefinition(
  7006. formid varchar(30)
  7007. , gridname varchar(30)
  7008. , companycode varchar(3)
  7009. , userkey varchar(10)
  7010. , workstationname varchar(30)
  7011. , level varchar(1)
  7012. , seq varchar(3)
  7013. , modulecode varchar(3)
  7014. , iolvar varchar(50)
  7015. , aliasvar varchar(50)
  7016. , moveable varchar(1)
  7017. , lockfld varchar(1)
  7018. , coldesc varchar(40)
  7019. , celltype varchar(30)
  7020. , hideable varchar(1)
  7021. , hidden varchar(1)
  7022. , frozen varchar(1)
  7023. , tag text
  7024. , gridloc varchar(1)
  7025. , formatmask varchar(25)
  7026. , class varchar(30)
  7027. , hidegroups varchar(75)
  7028. , othergroups varchar(75)
  7029. , implieddecimal varchar(1)
  7030. , secondarygridcoldesc varchar(40)
  7031. , enhancementcode varchar(140)
  7032. , colwidth numeric(15,4)
  7033. , autocomplete varchar(64)
  7034. , CONSTRAINT rsy_griddefinition_KEY0_pk PRIMARY KEY (formid,gridname,companycode,userkey,workstationname,level,seq)
  7035. , CONSTRAINT rsy_griddefinition_KEY0_check CHECK (formid is not null and gridname is not null and companycode is not null and userkey is not null and workstationname is not null and level is not null and seq IS NOT NULL)
  7036. ) WITH (OIDS=FALSE);
  7037. CREATE INDEX rsy_griddefinition_KEY1_index ON sageimport.rsy_griddefinition (aliasvar,formid,gridname,companycode,userkey,workstationname,level);
  7038.  
  7039.  
  7040. CREATE TABLE sageimport.rsy_lastformused(
  7041. modulecode varchar(3)
  7042. , companykey varchar(10)
  7043. , userkey varchar(10)
  7044. , workstationname varchar(30)
  7045. , reportid varchar(30)
  7046. , reportsetting varchar(20)
  7047. , invoicehistorytype varchar(1)
  7048. , CONSTRAINT rsy_lastformused_KEY0_pk PRIMARY KEY (modulecode,companykey,userkey,reportid,workstationname)
  7049. , CONSTRAINT rsy_lastformused_KEY0_check CHECK (modulecode is not null and companykey is not null and userkey is not null and reportid is not null and workstationname IS NOT NULL)
  7050. ) WITH (OIDS=FALSE);
  7051. CREATE INDEX rsy_lastformused_KEY1_index ON sageimport.rsy_lastformused (modulecode,companykey,workstationname,reportid);
  7052.  
  7053.  
  7054. CREATE TABLE sageimport.rsy_lockfiles(
  7055. tablename varchar(127)
  7056. , programlist text
  7057. , modulecode varchar(3)
  7058. , developercode varchar(3)
  7059. , CONSTRAINT rsy_lockfiles_KEY0_pk PRIMARY KEY (tablename)
  7060. , CONSTRAINT rsy_lockfiles_KEY0_check CHECK (tablename IS NOT NULL)
  7061. ) WITH (OIDS=FALSE);
  7062. CREATE INDEX rsy_lockfiles_KEY1_index ON sageimport.rsy_lockfiles (modulecode,developercode,tablename);
  7063.  
  7064.  
  7065. CREATE TABLE sageimport.rsy_memodefault(
  7066. modulecode varchar(3)
  7067. , memotype varchar(2)
  7068. , memofunction varchar(30)
  7069. , functiondesc varchar(30)
  7070. , memooption varchar(1)
  7071. , autodisplay varchar(1)
  7072. , CONSTRAINT rsy_memodefault_KEY0_pk PRIMARY KEY (modulecode,memotype,memofunction)
  7073. , CONSTRAINT rsy_memodefault_KEY0_check CHECK (modulecode is not null and memotype is not null and memofunction IS NOT NULL)
  7074. ) WITH (OIDS=FALSE);
  7075.  
  7076.  
  7077. CREATE TABLE sageimport.rsy_memomanager(
  7078. modulecode varchar(3)
  7079. , memotype varchar(2)
  7080. , memotypedesc varchar(30)
  7081. , memotable varchar(30)
  7082. , memosettingstable varchar(30)
  7083. , memokeyname varchar(30)
  7084. , memokeyfieldname varchar(128)
  7085. , memokeyfielddisplayname varchar(30)
  7086. , memokeytable varchar(30)
  7087. , memokeylookupexpression varchar(128)
  7088. , memokeylookupcode varchar(30)
  7089. , memokeydescfield varchar(30)
  7090. , specialmaskingrequired varchar(1)
  7091. , printtask varchar(50)
  7092. , memokeyfieldlookup varchar(30)
  7093. , allowtomaintainflowedmemo varchar(1)
  7094. , developercode varchar(3)
  7095. , memokeylength numeric(15,4)
  7096. , CONSTRAINT rsy_memomanager_KEY0_pk PRIMARY KEY (modulecode,memotype)
  7097. , CONSTRAINT rsy_memomanager_KEY0_check CHECK (modulecode is not null and memotype IS NOT NULL)
  7098. ) WITH (OIDS=FALSE);
  7099.  
  7100.  
  7101. CREATE TABLE sageimport.rsy_memorelationship(
  7102. sourcemodulecode varchar(3)
  7103. , sourcememotype varchar(2)
  7104. , context varchar(64)
  7105. , developercode varchar(3)
  7106. , destmodulecode varchar(3)
  7107. , destmemotype varchar(2)
  7108. , flownewrecord varchar(1)
  7109. , CONSTRAINT rsy_memorelationship_KEY0_pk PRIMARY KEY (sourcemodulecode,sourcememotype,context)
  7110. , CONSTRAINT rsy_memorelationship_KEY0_check CHECK (sourcemodulecode is not null and sourcememotype is not null and context IS NOT NULL)
  7111. ) WITH (OIDS=FALSE);
  7112.  
  7113.  
  7114. CREATE TABLE sageimport.rsy_menu(
  7115. modulecode varchar(3)
  7116. , taskkey varchar(9)
  7117. , sequence varchar(3)
  7118. , modulenumber varchar(2)
  7119. , developercode varchar(3)
  7120. , position varchar(10)
  7121. , menuname varchar(40)
  7122. , menudescription varchar(50)
  7123. , parentmodulecode varchar(3)
  7124. , parenttaskkey varchar(9)
  7125. , parentsequence varchar(3)
  7126. , parentposition varchar(10)
  7127. , checked varchar(1)
  7128. , CONSTRAINT rsy_menu_KEY0_pk PRIMARY KEY (modulecode,taskkey,sequence)
  7129. , CONSTRAINT rsy_menu_KEY0_check CHECK (modulecode is not null and taskkey is not null and sequence IS NOT NULL)
  7130. ) WITH (OIDS=FALSE);
  7131. CREATE INDEX rsy_menu_KEY1_index ON sageimport.rsy_menu (position,modulecode,taskkey,sequence);
  7132. CREATE INDEX rsy_menu_KEY2_index ON sageimport.rsy_menu (parentposition,parentmodulecode,parenttaskkey,parentsequence);
  7133. CREATE INDEX rsy_menu_KEY3_index ON sageimport.rsy_menu (modulecode,sequence,menuname);
  7134. CREATE INDEX rsy_menu_KEY4_index ON sageimport.rsy_menu (parentmodulecode,parenttaskkey,position);
  7135. CREATE INDEX rsy_menu_KEY5_index ON sageimport.rsy_menu (taskkey,sequence,modulecode);
  7136.  
  7137.  
  7138. CREATE TABLE sageimport.rsy_message(
  7139. msgid varchar(64)
  7140. , messagetext text
  7141. , CONSTRAINT rsy_message_KEY0_pk PRIMARY KEY (msgid)
  7142. , CONSTRAINT rsy_message_KEY0_check CHECK (msgid IS NOT NULL)
  7143. ) WITH (OIDS=FALSE);
  7144. CREATE INDEX rsy_message_KEY1_index ON sageimport.rsy_message (messagetext);
  7145.  
  7146.  
  7147. CREATE TABLE sageimport.rsy_module(
  7148. modulecode varchar(3)
  7149. , modulename varchar(50)
  7150. , developercode varchar(3)
  7151. , modulelevel numeric(15,4)
  7152. , conversionlevel numeric(15,4)
  7153. , everest varchar(1)
  7154. , partnumber varchar(10)
  7155. , buildnumber numeric(15,4)
  7156. , releasedate date
  7157. , listorder varchar(5)
  7158. , conversionorder varchar(5)
  7159. , activationorder varchar(5)
  7160. , registrationrequired varchar(1)
  7161. , activationskip varchar(1)
  7162. , expirationdate date
  7163. , modulenumber varchar(2)
  7164. , allowuninstall varchar(1)
  7165. , startupscreen varchar(1)
  7166. , nooptionsfile varchar(1)
  7167. , allowbatches varchar(1)
  7168. , securitychecksum varchar(10)
  7169. , nocustomizerallowed varchar(1)
  7170. , notrialperiod varchar(1)
  7171. , nocompanydata varchar(1)
  7172. , sublevel numeric(15,4)
  7173. , servicepack numeric(15,4)
  7174. , relationaldatabasecompliant varchar(1)
  7175. , CONSTRAINT rsy_module_KEY0_pk PRIMARY KEY (modulecode)
  7176. , CONSTRAINT rsy_module_KEY0_check CHECK (modulecode IS NOT NULL)
  7177. ) WITH (OIDS=FALSE);
  7178. CREATE INDEX rsy_module_KEY1_index ON sageimport.rsy_module (conversionorder,modulecode);
  7179. CREATE INDEX rsy_module_KEY2_index ON sageimport.rsy_module (activationorder,modulecode);
  7180. CREATE INDEX rsy_module_KEY3_index ON sageimport.rsy_module (listorder,modulecode);
  7181. CREATE INDEX rsy_module_KEY4_index ON sageimport.rsy_module (modulenumber);
  7182. CREATE INDEX rsy_module_KEY5_index ON sageimport.rsy_module (modulename);
  7183.  
  7184.  
  7185. CREATE TABLE sageimport.rsy_moduledate(
  7186. userkey varchar(10)
  7187. , companykey varchar(10)
  7188. , modulecode varchar(3)
  7189. , lastdate date
  7190. , CONSTRAINT rsy_moduledate_KEY0_pk PRIMARY KEY (userkey,companykey,modulecode)
  7191. , CONSTRAINT rsy_moduledate_KEY0_check CHECK (userkey is not null and companykey is not null and modulecode IS NOT NULL)
  7192. ) WITH (OIDS=FALSE);
  7193.  
  7194.  
  7195. CREATE TABLE sageimport.rsy_multipartform(
  7196. companykey varchar(10)
  7197. , reportid varchar(30)
  7198. , reportsetting varchar(20)
  7199. , sequenceno varchar(14)
  7200. , printshadow varchar(1)
  7201. , shadowtext varchar(10)
  7202. , printer varchar(80)
  7203. , collated varchar(1)
  7204. , numberofcopies numeric(15,4)
  7205. , paperorientation numeric(15,4)
  7206. , papersize numeric(15,4)
  7207. , papersource numeric(15,4)
  7208. , printerduplex numeric(15,4)
  7209. , CONSTRAINT rsy_multipartform_KEY0_pk PRIMARY KEY (reportid,reportsetting,companykey,sequenceno)
  7210. , CONSTRAINT rsy_multipartform_KEY0_check CHECK (reportid is not null and reportsetting is not null and companykey is not null and sequenceno IS NOT NULL)
  7211. ) WITH (OIDS=FALSE);
  7212.  
  7213.  
  7214. CREATE TABLE sageimport.rsy_payrollefilingmapping(
  7215. title varchar(40)
  7216. , pimidentifier varchar(5)
  7217. , description varchar(50)
  7218. , taxtype varchar(5)
  7219. , statecode varchar(2)
  7220. , otherinformation varchar(30)
  7221. , w2localitytaxtypecode varchar(1)
  7222. , CONSTRAINT rsy_payrollefilingmapping_KEY0_pk PRIMARY KEY (statecode,pimidentifier)
  7223. , CONSTRAINT rsy_payrollefilingmapping_KEY0_check CHECK (statecode is not null and pimidentifier IS NOT NULL)
  7224. ) WITH (OIDS=FALSE);
  7225.  
  7226.  
  7227. CREATE TABLE sageimport.rsy_periodendreport(
  7228. modulecode varchar(3)
  7229. , companykey varchar(10)
  7230. , sequenceno varchar(14)
  7231. , reportid varchar(30)
  7232. , reportsetting varchar(20)
  7233. , savedprinter varchar(1)
  7234. , print varchar(1)
  7235. , numberofcopies numeric(15,4)
  7236. , CONSTRAINT rsy_periodendreport_KEY0_pk PRIMARY KEY (modulecode,companykey,sequenceno)
  7237. , CONSTRAINT rsy_periodendreport_KEY0_check CHECK (modulecode is not null and companykey is not null and sequenceno IS NOT NULL)
  7238. ) WITH (OIDS=FALSE);
  7239. CREATE INDEX rsy_periodendreport_KEY1_index ON sageimport.rsy_periodendreport (modulecode,companykey,reportid,reportsetting);
  7240.  
  7241.  
  7242. CREATE TABLE sageimport.rsy_personalize(
  7243. recordflag varchar(1)
  7244. , librarypath varchar(72)
  7245. , libraryform varchar(12)
  7246. , userkey varchar(10)
  7247. , workstationname varchar(30)
  7248. , timestamp varchar(16)
  7249. , ctlinfo varchar(16)
  7250. , maximized numeric(15,4)
  7251. , ccolumn numeric(15,4)
  7252. , rrow numeric(15,4)
  7253. , width numeric(15,4)
  7254. , height numeric(15,4)
  7255. , CONSTRAINT rsy_personalize_KEY0_pk PRIMARY KEY (recordflag,librarypath,libraryform,userkey,workstationname)
  7256. , CONSTRAINT rsy_personalize_KEY0_check CHECK (recordflag is not null and librarypath is not null and libraryform is not null and userkey is not null and workstationname IS NOT NULL)
  7257. ) WITH (OIDS=FALSE);
  7258.  
  7259.  
  7260. CREATE TABLE sageimport.rsy_personalizeale(
  7261. recordflag varchar(1)
  7262. , userkey varchar(10)
  7263. , workstationname varchar(30)
  7264. , timestamp varchar(16)
  7265. , ctlinfo varchar(16)
  7266. , company varchar(3)
  7267. , lookup varchar(20)
  7268. , view varchar(2)
  7269. , maximized numeric(15,4)
  7270. , ccolumn numeric(15,4)
  7271. , rrow numeric(15,4)
  7272. , width numeric(15,4)
  7273. , height numeric(15,4)
  7274. , CONSTRAINT rsy_personalizeale_KEY0_pk PRIMARY KEY (recordflag,userkey,workstationname,company,lookup,view)
  7275. , CONSTRAINT rsy_personalizeale_KEY0_check CHECK (recordflag is not null and userkey is not null and workstationname is not null and company is not null and lookup is not null and view IS NOT NULL)
  7276. ) WITH (OIDS=FALSE);
  7277.  
  7278.  
  7279. CREATE TABLE sageimport.rsy_popupitem(
  7280. itemid varchar(10)
  7281. , modulecode varchar(3)
  7282. , itemdesc varchar(75)
  7283. , grouping varchar(10)
  7284. , preinit varchar(1)
  7285. , preinitexpr varchar(128)
  7286. , onselect varchar(1)
  7287. , onselectexpr varchar(128)
  7288. , checksecurity varchar(1)
  7289. , menuitemdesc varchar(50)
  7290. , enhancementcode varchar(140)
  7291. , CONSTRAINT rsy_popupitem_KEY0_pk PRIMARY KEY (itemid)
  7292. , CONSTRAINT rsy_popupitem_KEY0_check CHECK (itemid IS NOT NULL)
  7293. ) WITH (OIDS=FALSE);
  7294. CREATE INDEX rsy_popupitem_KEY1_index ON sageimport.rsy_popupitem (itemdesc,itemid);
  7295. CREATE INDEX rsy_popupitem_KEY2_index ON sageimport.rsy_popupitem (menuitemdesc,itemid);
  7296.  
  7297.  
  7298. CREATE TABLE sageimport.rsy_popupmenu(
  7299. menuid varchar(10)
  7300. , menudesc varchar(50)
  7301. , textdesc varchar(75)
  7302. , linked varchar(1)
  7303. , enhancementcode varchar(140)
  7304. , CONSTRAINT rsy_popupmenu_KEY0_pk PRIMARY KEY (menuid)
  7305. , CONSTRAINT rsy_popupmenu_KEY0_check CHECK (menuid IS NOT NULL)
  7306. ) WITH (OIDS=FALSE);
  7307. CREATE INDEX rsy_popupmenu_KEY1_index ON sageimport.rsy_popupmenu (menudesc,menuid);
  7308. CREATE INDEX rsy_popupmenu_KEY2_index ON sageimport.rsy_popupmenu (textdesc,menuid);
  7309.  
  7310.  
  7311. CREATE TABLE sageimport.rsy_popupmenuitem(
  7312. menuid varchar(10)
  7313. , companykey varchar(10)
  7314. , userkey varchar(10)
  7315. , sequenceno varchar(5)
  7316. , itemid varchar(10)
  7317. , linked varchar(1)
  7318. , linkedmenuid varchar(10)
  7319. , enhancementcode varchar(140)
  7320. , CONSTRAINT rsy_popupmenuitem_KEY0_pk PRIMARY KEY (menuid,companykey,userkey,sequenceno)
  7321. , CONSTRAINT rsy_popupmenuitem_KEY0_check CHECK (menuid is not null and companykey is not null and userkey is not null and sequenceno IS NOT NULL)
  7322. ) WITH (OIDS=FALSE);
  7323. CREATE INDEX rsy_popupmenuitem_KEY1_index ON sageimport.rsy_popupmenuitem (itemid);
  7324. CREATE INDEX rsy_popupmenuitem_KEY2_index ON sageimport.rsy_popupmenuitem (linkedmenuid);
  7325.  
  7326.  
  7327. CREATE TABLE sageimport.rsy_popupxref(
  7328. identity varchar(10)
  7329. , menuid varchar(10)
  7330. , library varchar(45)
  7331. , form varchar(12)
  7332. , panel varchar(12)
  7333. , dataclass varchar(30)
  7334. , control varchar(30)
  7335. , gridclass varchar(30)
  7336. , enhancementcode varchar(140)
  7337. , modulecode varchar(3)
  7338. , CONSTRAINT rsy_popupxref_KEY0_pk PRIMARY KEY (identity)
  7339. , CONSTRAINT rsy_popupxref_KEY0_check CHECK (identity IS NOT NULL)
  7340. ) WITH (OIDS=FALSE);
  7341. CREATE INDEX rsy_popupxref_KEY1_index ON sageimport.rsy_popupxref (menuid,identity);
  7342. CREATE INDEX rsy_popupxref_KEY2_index ON sageimport.rsy_popupxref (library,form,panel,dataclass,gridclass,control);
  7343. CREATE INDEX rsy_popupxref_KEY3_index ON sageimport.rsy_popupxref (gridclass,identity);
  7344. CREATE INDEX rsy_popupxref_KEY4_index ON sageimport.rsy_popupxref (dataclass,identity);
  7345. CREATE INDEX rsy_popupxref_KEY5_index ON sageimport.rsy_popupxref (control,identity);
  7346. CREATE INDEX rsy_popupxref_KEY6_index ON sageimport.rsy_popupxref (modulecode,identity);
  7347.  
  7348.  
  7349. CREATE TABLE sageimport.rsy_premigrationcompany(
  7350. companycode varchar(3)
  7351. , companyname varchar(50)
  7352. , datadirectory varchar(128)
  7353. , payrolldirectory varchar(128)
  7354. , CONSTRAINT rsy_premigrationcompany_KEY0_pk PRIMARY KEY (companycode)
  7355. , CONSTRAINT rsy_premigrationcompany_KEY0_check CHECK (companycode IS NOT NULL)
  7356. ) WITH (OIDS=FALSE);
  7357.  
  7358.  
  7359. CREATE TABLE sageimport.rsy_premigrationitemcode(
  7360. itemcode varchar(30)
  7361. , itemcodedesc varchar(30)
  7362. , CONSTRAINT rsy_premigrationitemcode_KEY0_pk PRIMARY KEY (itemcode)
  7363. , CONSTRAINT rsy_premigrationitemcode_KEY0_check CHECK (itemcode IS NOT NULL)
  7364. ) WITH (OIDS=FALSE);
  7365.  
  7366.  
  7367. CREATE TABLE sageimport.rsy_premigrationwarehouse(
  7368. warehousecode varchar(3)
  7369. , warehousedesc varchar(30)
  7370. , CONSTRAINT rsy_premigrationwarehouse_KEY0_pk PRIMARY KEY (warehousecode)
  7371. , CONSTRAINT rsy_premigrationwarehouse_KEY0_check CHECK (warehousecode IS NOT NULL)
  7372. ) WITH (OIDS=FALSE);
  7373.  
  7374.  
  7375. CREATE TABLE sageimport.rsy_processflows(
  7376. processflow varchar(24)
  7377. , menudesc varchar(40)
  7378. , modulecode varchar(3)
  7379. , allowmodification varchar(1)
  7380. , processflowfile varchar(128)
  7381. , datecreated date
  7382. , timecreated varchar(8)
  7383. , usercreatedkey varchar(10)
  7384. , dateupdated date
  7385. , timeupdated varchar(8)
  7386. , userupdatedkey varchar(10)
  7387. , CONSTRAINT rsy_processflows_KEY0_pk PRIMARY KEY (processflow)
  7388. , CONSTRAINT rsy_processflows_KEY0_check CHECK (processflow IS NOT NULL)
  7389. ) WITH (OIDS=FALSE);
  7390. CREATE INDEX rsy_processflows_KEY1_index ON sageimport.rsy_processflows (modulecode,menudesc,processflow);
  7391.  
  7392.  
  7393. CREATE TABLE sageimport.rsy_reportmanagerformat(
  7394. modulecode varchar(3)
  7395. , companykey varchar(10)
  7396. , reportid varchar(30)
  7397. , reportsetting varchar(20)
  7398. , ttype varchar(1)
  7399. , formatdesc varchar(40)
  7400. , enablefax varchar(1)
  7401. , faxsubject varchar(60)
  7402. , faxusecoverpagefile varchar(1)
  7403. , faxcoverpagetext text
  7404. , faxcoverpagefile varchar(136)
  7405. , faxbillcode varchar(30)
  7406. , faxkeywords varchar(60)
  7407. , faxhold varchar(1)
  7408. , faxusecreditcard varchar(1)
  7409. , faxsendoffpeak varchar(1)
  7410. , faxusehighresolution varchar(1)
  7411. , faxprinter varchar(60)
  7412. , faxpriority numeric(15,4)
  7413. , CONSTRAINT rsy_reportmanagerformat_KEY0_pk PRIMARY KEY (modulecode,companykey,reportid,reportsetting)
  7414. , CONSTRAINT rsy_reportmanagerformat_KEY0_check CHECK (modulecode is not null and companykey is not null and reportid is not null and reportsetting IS NOT NULL)
  7415. ) WITH (OIDS=FALSE);
  7416.  
  7417.  
  7418. CREATE TABLE sageimport.rsy_reportmanagermaster(
  7419. modulecode varchar(3)
  7420. , developercode varchar(3)
  7421. , reportid varchar(30)
  7422. , reportdesc varchar(40)
  7423. , ttype varchar(1)
  7424. , batchfaxingavailable varchar(1)
  7425. , CONSTRAINT rsy_reportmanagermaster_KEY0_pk PRIMARY KEY (modulecode,developercode,reportid)
  7426. , CONSTRAINT rsy_reportmanagermaster_KEY0_check CHECK (modulecode is not null and developercode is not null and reportid IS NOT NULL)
  7427. ) WITH (OIDS=FALSE);
  7428. CREATE INDEX rsy_reportmanagermaster_KEY1_index ON sageimport.rsy_reportmanagermaster (reportdesc,modulecode,developercode,reportid);
  7429. CREATE INDEX rsy_reportmanagermaster_KEY2_index ON sageimport.rsy_reportmanagermaster (modulecode,reportid);
  7430.  
  7431.  
  7432. CREATE TABLE sageimport.rsy_reportmanagertemplate(
  7433. modulecode varchar(3)
  7434. , developercode varchar(3)
  7435. , reportid varchar(30)
  7436. , templatedesc varchar(50)
  7437. , rptname varchar(50)
  7438. , CONSTRAINT rsy_reportmanagertemplate_KEY0_pk PRIMARY KEY (modulecode,developercode,reportid,templatedesc)
  7439. , CONSTRAINT rsy_reportmanagertemplate_KEY0_check CHECK (modulecode is not null and developercode is not null and reportid is not null and templatedesc IS NOT NULL)
  7440. ) WITH (OIDS=FALSE);
  7441. CREATE INDEX rsy_reportmanagertemplate_KEY1_index ON sageimport.rsy_reportmanagertemplate (modulecode,reportid,developercode,rptname);
  7442.  
  7443.  
  7444. CREATE TABLE sageimport.rsy_reportoption(
  7445. modulecode varchar(3)
  7446. , companykey varchar(10)
  7447. , reportid varchar(30)
  7448. , reportsetting varchar(20)
  7449. , optionsstring text
  7450. , CONSTRAINT rsy_reportoption_KEY0_pk PRIMARY KEY (modulecode,companykey,reportid,reportsetting)
  7451. , CONSTRAINT rsy_reportoption_KEY0_check CHECK (modulecode is not null and companykey is not null and reportid is not null and reportsetting IS NOT NULL)
  7452. ) WITH (OIDS=FALSE);
  7453.  
  7454.  
  7455. CREATE TABLE sageimport.rsy_reportselection(
  7456. modulecode varchar(3)
  7457. , companykey varchar(10)
  7458. , reportid varchar(30)
  7459. , reportsetting varchar(20)
  7460. , rowkey varchar(5)
  7461. , selectfield varchar(50)
  7462. , selectfieldvalue varchar(50)
  7463. , keyreference varchar(50)
  7464. , tag varchar(200)
  7465. , operand varchar(1)
  7466. , value1 text
  7467. , value2 varchar(200)
  7468. , CONSTRAINT rsy_reportselection_KEY0_pk PRIMARY KEY (modulecode,companykey,reportid,reportsetting,rowkey)
  7469. , CONSTRAINT rsy_reportselection_KEY0_check CHECK (modulecode is not null and companykey is not null and reportid is not null and reportsetting is not null and rowkey IS NOT NULL)
  7470. ) WITH (OIDS=FALSE);
  7471.  
  7472.  
  7473. CREATE TABLE sageimport.rsy_reportsetting(
  7474. modulecode varchar(3)
  7475. , companykey varchar(10)
  7476. , reportid varchar(30)
  7477. , reportsetting varchar(20)
  7478. , defaultreport varchar(1)
  7479. , description varchar(60)
  7480. , settingoptionstype varchar(1)
  7481. , printreportsettings varchar(1)
  7482. , printername varchar(100)
  7483. , sortreportby varchar(1)
  7484. , pagebreak varchar(1)
  7485. , collated varchar(1)
  7486. , threeholepunch varchar(1)
  7487. , multipart varchar(1)
  7488. , templatedesc varchar(50)
  7489. , line1message varchar(150)
  7490. , line2message varchar(150)
  7491. , officetemplatename varchar(40)
  7492. , useofficetemplate varchar(1)
  7493. , numberofcopies numeric(15,4)
  7494. , paperorientation numeric(15,4)
  7495. , papersize numeric(15,4)
  7496. , papersource numeric(15,4)
  7497. , printerduplex numeric(15,4)
  7498. , reportpreviewzoom numeric(15,4)
  7499. , datecreated date
  7500. , timecreated varchar(8)
  7501. , usercreatedkey varchar(10)
  7502. , dateupdated date
  7503. , timeupdated varchar(8)
  7504. , userupdatedkey varchar(10)
  7505. , workstationname varchar(30)
  7506. , CONSTRAINT rsy_reportsetting_KEY0_pk PRIMARY KEY (modulecode,companykey,reportid,reportsetting,workstationname)
  7507. , CONSTRAINT rsy_reportsetting_KEY0_check CHECK (modulecode is not null and companykey is not null and reportid is not null and reportsetting is not null and workstationname IS NOT NULL)
  7508. ) WITH (OIDS=FALSE);
  7509. CREATE INDEX rsy_reportsetting_KEY1_index ON sageimport.rsy_reportsetting (defaultreport,usercreatedkey,modulecode,companykey,reportid,reportsetting,workstationname);
  7510. CREATE INDEX rsy_reportsetting_KEY2_index ON sageimport.rsy_reportsetting (defaultreport,modulecode,companykey,reportid,reportsetting,workstationname);
  7511.  
  7512.  
  7513. CREATE TABLE sageimport.rsy_reportwizardexpressions(
  7514. reportid varchar(30)
  7515. , ttype varchar(1)
  7516. , expressionid varchar(8)
  7517. , columnname varchar(127)
  7518. , caption varchar(30)
  7519. , justification varchar(1)
  7520. , length varchar(3)
  7521. , datatype varchar(1)
  7522. , calculation varchar(3)
  7523. , ggroup varchar(1)
  7524. , decimalplaces varchar(1)
  7525. , negativevalues varchar(1)
  7526. , decimalseparator varchar(1)
  7527. , thousandsseparator varchar(1)
  7528. , stringmask varchar(64)
  7529. , cangrow varchar(1)
  7530. , expression text
  7531. , linktable varchar(30)
  7532. , enabled varchar(1)
  7533. , originalfield varchar(1)
  7534. , itm_src_id varchar(32)
  7535. , itm_name varchar(30)
  7536. , itm_fld_seq varchar(4)
  7537. , itm_class varchar(24)
  7538. , vue_seq varchar(4)
  7539. , vue_path varchar(240)
  7540. , CONSTRAINT rsy_reportwizardexpressions_KEY0_pk PRIMARY KEY (reportid,ttype,expressionid)
  7541. , CONSTRAINT rsy_reportwizardexpressions_KEY0_check CHECK (reportid is not null and ttype is not null and expressionid IS NOT NULL)
  7542. ) WITH (OIDS=FALSE);
  7543. CREATE INDEX rsy_reportwizardexpressions_KEY1_index ON sageimport.rsy_reportwizardexpressions (reportid,ttype,columnname);
  7544. CREATE INDEX rsy_reportwizardexpressions_KEY2_index ON sageimport.rsy_reportwizardexpressions (reportid,expressionid);
  7545. CREATE INDEX rsy_reportwizardexpressions_KEY3_index ON sageimport.rsy_reportwizardexpressions (reportid,ggroup);
  7546. CREATE INDEX rsy_reportwizardexpressions_KEY4_index ON sageimport.rsy_reportwizardexpressions (reportid,itm_name);
  7547.  
  7548.  
  7549. CREATE TABLE sageimport.rsy_reportwizardfields(
  7550. reportid varchar(30)
  7551. , fieldid varchar(8)
  7552. , expressionid varchar(8)
  7553. , CONSTRAINT rsy_reportwizardfields_KEY0_pk PRIMARY KEY (reportid,fieldid)
  7554. , CONSTRAINT rsy_reportwizardfields_KEY0_check CHECK (reportid is not null and fieldid IS NOT NULL)
  7555. ) WITH (OIDS=FALSE);
  7556.  
  7557.  
  7558. CREATE TABLE sageimport.rsy_reportwizardfilters(
  7559. reportid varchar(30)
  7560. , filterid varchar(8)
  7561. , expressionid varchar(8)
  7562. , operand varchar(1)
  7563. , value1 varchar(30)
  7564. , value2 varchar(30)
  7565. , runtime varchar(1)
  7566. , CONSTRAINT rsy_reportwizardfilters_KEY0_pk PRIMARY KEY (reportid,filterid)
  7567. , CONSTRAINT rsy_reportwizardfilters_KEY0_check CHECK (reportid is not null and filterid IS NOT NULL)
  7568. ) WITH (OIDS=FALSE);
  7569.  
  7570.  
  7571. CREATE TABLE sageimport.rsy_reportwizardgroups(
  7572. reportid varchar(30)
  7573. , groupid varchar(8)
  7574. , sortid varchar(8)
  7575. , sequence varchar(3)
  7576. , expressionid varchar(8)
  7577. , location varchar(1)
  7578. , calculation varchar(3)
  7579. , grouppath text
  7580. , CONSTRAINT rsy_reportwizardgroups_KEY0_pk PRIMARY KEY (reportid,groupid,sortid,sequence)
  7581. , CONSTRAINT rsy_reportwizardgroups_KEY0_check CHECK (reportid is not null and groupid is not null and sortid is not null and sequence IS NOT NULL)
  7582. ) WITH (OIDS=FALSE);
  7583.  
  7584.  
  7585. CREATE TABLE sageimport.rsy_reportwizardlinks(
  7586. reportid varchar(30)
  7587. , datasource varchar(64)
  7588. , keyinfo varchar(255)
  7589. , keyno varchar(2)
  7590. , newlink varchar(1)
  7591. , lnk_parent varchar(64)
  7592. , lnk_descr varchar(32)
  7593. , lnk_type varchar(1)
  7594. , lnk_nodata varchar(1)
  7595. , lnk_keydef text
  7596. , lnk_prefix varchar(10)
  7597. , CONSTRAINT rsy_reportwizardlinks_KEY0_pk PRIMARY KEY (reportid,datasource)
  7598. , CONSTRAINT rsy_reportwizardlinks_KEY0_check CHECK (reportid is not null and datasource IS NOT NULL)
  7599. ) WITH (OIDS=FALSE);
  7600.  
  7601.  
  7602. CREATE TABLE sageimport.rsy_reportwizardmain(
  7603. reportid varchar(30)
  7604. , reportdescription varchar(50)
  7605. , viewused varchar(8)
  7606. , maindatasource varchar(46)
  7607. , template varchar(30)
  7608. , collated varchar(1)
  7609. , printsettings varchar(1)
  7610. , threeholepunch varchar(1)
  7611. , crystalreport varchar(30)
  7612. , copies numeric(15,4)
  7613. , advancedlogic text
  7614. , addcustom varchar(1)
  7615. , module varchar(3)
  7616. , printsummary varchar(1)
  7617. , chaintoreport varchar(30)
  7618. , chaintoreportsetting varchar(20)
  7619. , migrated varchar(1)
  7620. , CONSTRAINT rsy_reportwizardmain_KEY0_pk PRIMARY KEY (reportid)
  7621. , CONSTRAINT rsy_reportwizardmain_KEY0_check CHECK (reportid IS NOT NULL)
  7622. ) WITH (OIDS=FALSE);
  7623. CREATE INDEX rsy_reportwizardmain_KEY1_index ON sageimport.rsy_reportwizardmain (viewused);
  7624.  
  7625.  
  7626. CREATE TABLE sageimport.rsy_reportwizardroles(
  7627. reportid varchar(30)
  7628. , rolekey varchar(10)
  7629. , CONSTRAINT rsy_reportwizardroles_KEY0_pk PRIMARY KEY (reportid,rolekey)
  7630. , CONSTRAINT rsy_reportwizardroles_KEY0_check CHECK (reportid is not null and rolekey IS NOT NULL)
  7631. ) WITH (OIDS=FALSE);
  7632.  
  7633.  
  7634. CREATE TABLE sageimport.rsy_reportwizardsorts(
  7635. reportid varchar(30)
  7636. , sequence varchar(3)
  7637. , sortid varchar(8)
  7638. , expressionid varchar(8)
  7639. , oorder varchar(1)
  7640. , breaktype varchar(1)
  7641. , breakheader varchar(1)
  7642. , breakfooter varchar(1)
  7643. , CONSTRAINT rsy_reportwizardsorts_KEY0_pk PRIMARY KEY (reportid,sequence,sortid)
  7644. , CONSTRAINT rsy_reportwizardsorts_KEY0_check CHECK (reportid is not null and sequence is not null and sortid IS NOT NULL)
  7645. ) WITH (OIDS=FALSE);
  7646. CREATE INDEX rsy_reportwizardsorts_KEY1_index ON sageimport.rsy_reportwizardsorts (reportid,sortid);
  7647.  
  7648.  
  7649. CREATE TABLE sageimport.rsy_reportwizardsources(
  7650. reportid varchar(30)
  7651. , datasource varchar(30)
  7652. , src_desc varchar(32)
  7653. , src_type varchar(1)
  7654. , src_expr_ind varchar(1)
  7655. , src_primary_source varchar(200)
  7656. , src_key varchar(64)
  7657. , src_order varchar(1)
  7658. , src_long_desc varchar(255)
  7659. , src_password varchar(12)
  7660. , CONSTRAINT rsy_reportwizardsources_KEY0_pk PRIMARY KEY (reportid,datasource)
  7661. , CONSTRAINT rsy_reportwizardsources_KEY0_check CHECK (reportid is not null and datasource IS NOT NULL)
  7662. ) WITH (OIDS=FALSE);
  7663.  
  7664.  
  7665. CREATE TABLE sageimport.rsy_role(
  7666. rolekey varchar(10)
  7667. , rolename varchar(15)
  7668. , roledescription varchar(50)
  7669. , hidden varchar(1)
  7670. , CONSTRAINT rsy_role_KEY0_pk PRIMARY KEY (rolekey)
  7671. , CONSTRAINT rsy_role_KEY0_check CHECK (rolekey IS NOT NULL)
  7672. , CONSTRAINT rsy_role_KEY1_unique UNIQUE (rolename)
  7673. ) WITH (OIDS=FALSE);
  7674. CREATE INDEX rsy_role_KEY2_index ON sageimport.rsy_role (hidden,rolename);
  7675.  
  7676.  
  7677. CREATE TABLE sageimport.rsy_rolesecurity(
  7678. rolekey varchar(10)
  7679. , modulecode varchar(3)
  7680. , taskkey varchar(9)
  7681. , tasktypekey varchar(2)
  7682. , developercode varchar(3)
  7683. , modulenumber varchar(3)
  7684. , createflag numeric(15,4)
  7685. , modifyflag numeric(15,4)
  7686. , removeflag numeric(15,4)
  7687. , printflag numeric(15,4)
  7688. , updateflag numeric(15,4)
  7689. , CONSTRAINT rsy_rolesecurity_KEY0_pk PRIMARY KEY (rolekey,taskkey)
  7690. , CONSTRAINT rsy_rolesecurity_KEY0_check CHECK (rolekey is not null and taskkey IS NOT NULL)
  7691. ) WITH (OIDS=FALSE);
  7692. CREATE INDEX rsy_rolesecurity_KEY1_index ON sageimport.rsy_rolesecurity (tasktypekey);
  7693. CREATE INDEX rsy_rolesecurity_KEY2_index ON sageimport.rsy_rolesecurity (modulecode,developercode);
  7694. CREATE INDEX rsy_rolesecurity_KEY3_index ON sageimport.rsy_rolesecurity (rolekey,modulecode,tasktypekey);
  7695. CREATE INDEX rsy_rolesecurity_KEY4_index ON sageimport.rsy_rolesecurity (rolekey,modulenumber,tasktypekey);
  7696. CREATE INDEX rsy_rolesecurity_KEY5_index ON sageimport.rsy_rolesecurity (taskkey,rolekey);
  7697.  
  7698.  
  7699. CREATE TABLE sageimport.rsy_sagepep(
  7700. workstationname varchar(30)
  7701. , sessionid varchar(15)
  7702. , timestamp varchar(25)
  7703. , keyname varchar(50)
  7704. , keyvalue text
  7705. , id varchar(10) DEFAULT nextval('global_seq'::text)
  7706. , CONSTRAINT rsy_sagepep_KEY0_pk PRIMARY KEY (workstationname,timestamp,keyname,id)
  7707. , CONSTRAINT rsy_sagepep_KEY0_check CHECK (workstationname is not null and timestamp is not null and keyname is not null and id IS NOT NULL)
  7708. ) WITH (OIDS=FALSE);
  7709. CREATE INDEX rsy_sagepep_KEY1_index ON sageimport.rsy_sagepep (workstationname,sessionid);
  7710.  
  7711.  
  7712. CREATE TABLE sageimport.rsy_sagepepsettings(
  7713. recordkey varchar(1)
  7714. , pepondemandversion varchar(30)
  7715. , downloaddt varchar(8)
  7716. , downloadwks varchar(30)
  7717. , processdt varchar(8)
  7718. , processwks varchar(30)
  7719. , CONSTRAINT rsy_sagepepsettings_KEY0_pk PRIMARY KEY (recordkey)
  7720. , CONSTRAINT rsy_sagepepsettings_KEY0_check CHECK (recordkey IS NOT NULL)
  7721. ) WITH (OIDS=FALSE);
  7722.  
  7723.  
  7724. CREATE TABLE sageimport.rsy_sagepeptask(
  7725. workstationname varchar(30)
  7726. , sessionid varchar(15)
  7727. , taskid varchar(9)
  7728. , moduleid varchar(3)
  7729. , taskname varchar(40)
  7730. , starttime varchar(25)
  7731. , endtime varchar(25)
  7732. , CONSTRAINT rsy_sagepeptask_KEY0_pk PRIMARY KEY (workstationname,taskid,starttime)
  7733. , CONSTRAINT rsy_sagepeptask_KEY0_check CHECK (workstationname is not null and taskid is not null and starttime IS NOT NULL)
  7734. ) WITH (OIDS=FALSE);
  7735. CREATE INDEX rsy_sagepeptask_KEY1_index ON sageimport.rsy_sagepeptask (workstationname,sessionid);
  7736.  
  7737.  
  7738. CREATE TABLE sageimport.rsy_salestaxclass(
  7739. taxclass varchar(2)
  7740. , taxclassdesc varchar(30)
  7741. , taxclasstype varchar(1)
  7742. , CONSTRAINT rsy_salestaxclass_KEY0_pk PRIMARY KEY (taxclass)
  7743. , CONSTRAINT rsy_salestaxclass_KEY0_check CHECK (taxclass IS NOT NULL)
  7744. ) WITH (OIDS=FALSE);
  7745.  
  7746.  
  7747. CREATE TABLE sageimport.rsy_salestaxcode(
  7748. taxcode varchar(15)
  7749. , taxcodedesc varchar(30)
  7750. , taxontax varchar(1)
  7751. , taxclassfortaxontax varchar(2)
  7752. , taxcodeshortdesc varchar(6)
  7753. , expensetovendoritem varchar(1)
  7754. , retentiontaxable varchar(1)
  7755. , taxlimit numeric(15,4)
  7756. , CONSTRAINT rsy_salestaxcode_KEY0_pk PRIMARY KEY (taxcode)
  7757. , CONSTRAINT rsy_salestaxcode_KEY0_check CHECK (taxcode IS NOT NULL)
  7758. ) WITH (OIDS=FALSE);
  7759. CREATE INDEX rsy_salestaxcode_KEY1_index ON sageimport.rsy_salestaxcode (taxclassfortaxontax,taxcode);
  7760.  
  7761.  
  7762. CREATE TABLE sageimport.rsy_salestaxcodedetail(
  7763. taxcode varchar(15)
  7764. , taxclass varchar(2)
  7765. , salestaxable varchar(1)
  7766. , purchasestaxable varchar(1)
  7767. , taxrate numeric(15,4)
  7768. , nonrecoverablepercent numeric(15,4)
  7769. , CONSTRAINT rsy_salestaxcodedetail_KEY0_pk PRIMARY KEY (taxcode,taxclass)
  7770. , CONSTRAINT rsy_salestaxcodedetail_KEY0_check CHECK (taxcode is not null and taxclass IS NOT NULL)
  7771. ) WITH (OIDS=FALSE);
  7772. CREATE INDEX rsy_salestaxcodedetail_KEY1_index ON sageimport.rsy_salestaxcodedetail (taxclass);
  7773.  
  7774.  
  7775. CREATE TABLE sageimport.rsy_salestaxschedule(
  7776. taxschedule varchar(9)
  7777. , taxscheduledesc varchar(30)
  7778. , printtaxcodeonforms varchar(1)
  7779. , CONSTRAINT rsy_salestaxschedule_KEY0_pk PRIMARY KEY (taxschedule)
  7780. , CONSTRAINT rsy_salestaxschedule_KEY0_check CHECK (taxschedule IS NOT NULL)
  7781. ) WITH (OIDS=FALSE);
  7782.  
  7783.  
  7784. CREATE TABLE sageimport.rsy_salestaxscheduledetail(
  7785. taxschedule varchar(9)
  7786. , lineseqno varchar(6)
  7787. , taxcode varchar(15)
  7788. , CONSTRAINT rsy_salestaxscheduledetail_KEY0_pk PRIMARY KEY (taxschedule,lineseqno,taxcode)
  7789. , CONSTRAINT rsy_salestaxscheduledetail_KEY0_check CHECK (taxschedule is not null and lineseqno is not null and taxcode IS NOT NULL)
  7790. ) WITH (OIDS=FALSE);
  7791. CREATE INDEX rsy_salestaxscheduledetail_KEY1_index ON sageimport.rsy_salestaxscheduledetail (taxcode,taxschedule,lineseqno);
  7792. CREATE INDEX rsy_salestaxscheduledetail_KEY2_index ON sageimport.rsy_salestaxscheduledetail (taxschedule,lineseqno,taxcode);
  7793.  
  7794.  
  7795. CREATE TABLE sageimport.rsy_sampleaccounts(
  7796. samplekey varchar(8)
  7797. , name varchar(30)
  7798. , mainaccount varchar(15)
  7799. , accountdesc varchar(40)
  7800. , sampletype varchar(3)
  7801. , CONSTRAINT rsy_sampleaccounts_KEY0_pk PRIMARY KEY (samplekey)
  7802. , CONSTRAINT rsy_sampleaccounts_KEY0_check CHECK (samplekey IS NOT NULL)
  7803. ) WITH (OIDS=FALSE);
  7804.  
  7805.  
  7806. CREATE TABLE sageimport.rsy_sqloptimize(
  7807. objectname varchar(36)
  7808. , tablename varchar(30)
  7809. , optimizationtype varchar(1)
  7810. , modulecode varchar(3)
  7811. , developercode varchar(3)
  7812. , CONSTRAINT rsy_sqloptimize_KEY0_pk PRIMARY KEY (objectname,tablename)
  7813. , CONSTRAINT rsy_sqloptimize_KEY0_check CHECK (objectname is not null and tablename IS NOT NULL)
  7814. ) WITH (OIDS=FALSE);
  7815. CREATE INDEX rsy_sqloptimize_KEY1_index ON sageimport.rsy_sqloptimize (modulecode,developercode,objectname,tablename);
  7816. CREATE INDEX rsy_sqloptimize_KEY2_index ON sageimport.rsy_sqloptimize (optimizationtype,objectname,tablename);
  7817.  
  7818.  
  7819. CREATE TABLE sageimport.rsy_state(
  7820. statecode varchar(2)
  7821. , statename varchar(30)
  7822. , countrycode varchar(3)
  7823. , geocode varchar(5)
  7824. , CONSTRAINT rsy_state_KEY0_pk PRIMARY KEY (statecode)
  7825. , CONSTRAINT rsy_state_KEY0_check CHECK (statecode IS NOT NULL)
  7826. ) WITH (OIDS=FALSE);
  7827. CREATE INDEX rsy_state_KEY1_index ON sageimport.rsy_state (statename);
  7828.  
  7829.  
  7830. CREATE TABLE sageimport.rsy_surrogate(
  7831. tablename varchar(30)
  7832. , tablekey varchar(30)
  7833. , tablecode varchar(30)
  7834. , nextsurrogate varchar(10)
  7835. , CONSTRAINT rsy_surrogate_KEY0_pk PRIMARY KEY (tablename)
  7836. , CONSTRAINT rsy_surrogate_KEY0_check CHECK (tablename IS NOT NULL)
  7837. ) WITH (OIDS=FALSE);
  7838.  
  7839.  
  7840. CREATE TABLE sageimport.rsy_task(
  7841. modulenumber varchar(2)
  7842. , taskowner varchar(1)
  7843. , developercode varchar(3)
  7844. , taskid varchar(3)
  7845. , taskname varchar(40)
  7846. , taskdescription varchar(100)
  7847. , programname varchar(30)
  7848. , tasktypekey varchar(2)
  7849. , codechecksum varchar(16)
  7850. , modulecode varchar(3)
  7851. , arguments text
  7852. , excludefromroles varchar(1)
  7853. , availableatperiodend varchar(1)
  7854. , defaultatperiodend varchar(1)
  7855. , canbescheduled varchar(1)
  7856. , legacymenuposition varchar(8)
  7857. , securityalias varchar(9)
  7858. , availableforpaperlessoffice varchar(1)
  7859. , excludefromplatforms varchar(2)
  7860. , CONSTRAINT rsy_task_KEY0_pk PRIMARY KEY (modulenumber,taskowner,developercode,taskid)
  7861. , CONSTRAINT rsy_task_KEY0_check CHECK (modulenumber is not null and taskowner is not null and developercode is not null and taskid IS NOT NULL)
  7862. ) WITH (OIDS=FALSE);
  7863. CREATE INDEX rsy_task_KEY1_index ON sageimport.rsy_task (programname);
  7864. CREATE INDEX rsy_task_KEY2_index ON sageimport.rsy_task (taskname);
  7865. CREATE INDEX rsy_task_KEY3_index ON sageimport.rsy_task (modulecode,tasktypekey,taskowner,developercode,taskid);
  7866. CREATE INDEX rsy_task_KEY4_index ON sageimport.rsy_task (programname,modulenumber,taskowner,developercode,taskid);
  7867. CREATE INDEX rsy_task_KEY5_index ON sageimport.rsy_task (legacymenuposition,modulenumber,taskowner,developercode,taskid);
  7868. CREATE INDEX rsy_task_KEY6_index ON sageimport.rsy_task (canbescheduled,modulenumber,taskowner,developercode,taskid);
  7869. CREATE INDEX rsy_task_KEY7_index ON sageimport.rsy_task (modulecode,programname);
  7870.  
  7871.  
  7872. CREATE TABLE sageimport.rsy_tasktype(
  7873. tasktypekey varchar(2)
  7874. , tasktypename varchar(30)
  7875. , tasktypedescription varchar(50)
  7876. , securitytype varchar(1)
  7877. , CONSTRAINT rsy_tasktype_KEY0_pk PRIMARY KEY (tasktypekey)
  7878. , CONSTRAINT rsy_tasktype_KEY0_check CHECK (tasktypekey IS NOT NULL)
  7879. ) WITH (OIDS=FALSE);
  7880. CREATE INDEX rsy_tasktype_KEY1_index ON sageimport.rsy_tasktype (tasktypename);
  7881.  
  7882.  
  7883. CREATE TABLE sageimport.rsy_template(
  7884. source varchar(40)
  7885. , templatetype varchar(3)
  7886. , templatename varchar(40)
  7887. , templatepath varchar(128)
  7888. , permissions varchar(1)
  7889. , private varchar(1)
  7890. , userkey varchar(10)
  7891. , workstationname varchar(30)
  7892. , CONSTRAINT rsy_template_KEY0_pk PRIMARY KEY (source,templatename)
  7893. , CONSTRAINT rsy_template_KEY0_check CHECK (source is not null and templatename IS NOT NULL)
  7894. ) WITH (OIDS=FALSE);
  7895.  
  7896.  
  7897. CREATE TABLE sageimport.rsy_theme(
  7898. themecode varchar(20)
  7899. , developercode varchar(3)
  7900. , themecodedesc varchar(30)
  7901. , systemtheme numeric(15,4)
  7902. , defaulttheme varchar(1)
  7903. , backgroundcolor varchar(25)
  7904. , framecolor varchar(25)
  7905. , defaultfontnum numeric(15,4)
  7906. , defaultfontcolor varchar(25)
  7907. , tabcolor varchar(25)
  7908. , tabfontcolor varchar(25)
  7909. , gridlinecolor1 varchar(25)
  7910. , gridlinecolor2 varchar(25)
  7911. , gridrowheight numeric(15,4)
  7912. , primarybuttoncolor varchar(25)
  7913. , primarybuttonfontcolor varchar(25)
  7914. , secondarybuttoncolor varchar(25)
  7915. , secondarybuttonfontcolor varchar(25)
  7916. , usenewtabstyle numeric(15,4)
  7917. , derivedfromclassic numeric(15,4)
  7918. , iconset varchar(1)
  7919. , CONSTRAINT rsy_theme_KEY0_pk PRIMARY KEY (themecode)
  7920. , CONSTRAINT rsy_theme_KEY0_check CHECK (themecode IS NOT NULL)
  7921. , CONSTRAINT rsy_theme_KEY1_unique UNIQUE (themecode,developercode)
  7922. ) WITH (OIDS=FALSE);
  7923.  
  7924.  
  7925. CREATE TABLE sageimport.rsy_token(
  7926. documenttype varchar(1)
  7927. , documentcontext varchar(30)
  7928. , token varchar(90)
  7929. , description text
  7930. , examplevalue varchar(150)
  7931. , sourcefile varchar(50)
  7932. , systemfile varchar(1)
  7933. , sourcefilekeyfields varchar(150)
  7934. , returnexpression text
  7935. , returntype varchar(1)
  7936. , CONSTRAINT rsy_token_KEY0_pk PRIMARY KEY (documenttype,documentcontext,token)
  7937. , CONSTRAINT rsy_token_KEY0_check CHECK (documenttype is not null and documentcontext is not null and token IS NOT NULL)
  7938. ) WITH (OIDS=FALSE);
  7939. CREATE INDEX rsy_token_KEY1_index ON sageimport.rsy_token (documentcontext,documenttype,token);
  7940.  
  7941.  
  7942. CREATE TABLE sageimport.rsy_urlmaintenance(
  7943. urlcode varchar(15)
  7944. , urldesc varchar(30)
  7945. , useproxyserver varchar(1)
  7946. , url text
  7947. , proxyserver text
  7948. , userid varchar(50)
  7949. , password varchar(50)
  7950. , timeout numeric(15,4)
  7951. , port numeric(15,4)
  7952. , permanent varchar(1)
  7953. , datecreated date
  7954. , timecreated varchar(8)
  7955. , usercreatedkey varchar(10)
  7956. , dateupdated date
  7957. , timeupdated varchar(8)
  7958. , userupdatedkey varchar(10)
  7959. , CONSTRAINT rsy_urlmaintenance_KEY0_pk PRIMARY KEY (urlcode)
  7960. , CONSTRAINT rsy_urlmaintenance_KEY0_check CHECK (urlcode IS NOT NULL)
  7961. ) WITH (OIDS=FALSE);
  7962.  
  7963.  
  7964. CREATE TABLE sageimport.rsy_user(
  7965. userkey varchar(10)
  7966. , usercode varchar(3)
  7967. , userlogon varchar(60)
  7968. , securitykey varchar(10)
  7969. , firstname varchar(20)
  7970. , lastname varchar(30)
  7971. , customizationcode varchar(3)
  7972. , password varchar(30)
  7973. , active varchar(1)
  7974. , inactivedate date
  7975. , lastcompany varchar(10)
  7976. , lookuplimit varchar(6)
  7977. , partiallookup varchar(1)
  7978. , implieddecimal varchar(1)
  7979. , autologoff varchar(1)
  7980. , inactivitytime varchar(3)
  7981. , enterkeyliketab varchar(1)
  7982. , inperiodend varchar(1)
  7983. , periodendprinter varchar(3)
  7984. , currentprinter varchar(3)
  7985. , lowspeedconnect varchar(1)
  7986. , systemdate date
  7987. , theme varchar(1)
  7988. , graphicreportformat varchar(1)
  7989. , reductionamountsinred varchar(1)
  7990. , promptforcompanycode varchar(1)
  7991. , usecrystalwebreports varchar(1)
  7992. , locked varchar(1)
  7993. , showhiddendialog varchar(1)
  7994. , external varchar(1)
  7995. , lockeddate numeric(15,4)
  7996. , lockedtime numeric(15,4)
  7997. , passworddate numeric(15,4)
  7998. , enablecsodbc varchar(1)
  7999. , appservspawn varchar(1)
  8000. , enablewebservicesforuser varchar(1)
  8001. , reportpreviewzoom numeric(15,4)
  8002. , surveyversion numeric(15,4)
  8003. , surveylaunchdate numeric(15,4)
  8004. , emailaddress varchar(250)
  8005. , jobtitle varchar(1)
  8006. , retainmoduleoncompanychange varchar(1)
  8007. , themecode varchar(20)
  8008. , CONSTRAINT rsy_user_KEY0_pk PRIMARY KEY (userkey)
  8009. , CONSTRAINT rsy_user_KEY0_check CHECK (userkey IS NOT NULL)
  8010. , CONSTRAINT rsy_user_KEY1_unique UNIQUE (usercode)
  8011. , CONSTRAINT rsy_user_KEY2_unique UNIQUE (userlogon)
  8012. ) WITH (OIDS=FALSE);
  8013. CREATE INDEX rsy_user_KEY3_index ON sageimport.rsy_user (securitykey);
  8014. CREATE INDEX rsy_user_KEY4_index ON sageimport.rsy_user (lastname,firstname);
  8015. CREATE INDEX rsy_user_KEY5_index ON sageimport.rsy_user (customizationcode,userkey);
  8016. CREATE INDEX rsy_user_KEY6_index ON sageimport.rsy_user (active,userlogon);
  8017. CREATE INDEX rsy_user_KEY7_index ON sageimport.rsy_user (external,active,userlogon);
  8018.  
  8019.  
  8020. CREATE TABLE sageimport.rsy_userautocomplete(
  8021. userkey varchar(10)
  8022. , autocompletecode varchar(64)
  8023. , autocompletecodedesc varchar(30)
  8024. , autocompleteentityenabled varchar(1)
  8025. , CONSTRAINT rsy_userautocomplete_KEY0_pk PRIMARY KEY (userkey,autocompletecode)
  8026. , CONSTRAINT rsy_userautocomplete_KEY0_check CHECK (userkey is not null and autocompletecode IS NOT NULL)
  8027. ) WITH (OIDS=FALSE);
  8028.  
  8029.  
  8030. CREATE TABLE sageimport.rsy_userhistory(
  8031. userkey varchar(10)
  8032. , usercode varchar(3)
  8033. , userlogon varchar(60)
  8034. , securitykey varchar(10)
  8035. , firstname varchar(20)
  8036. , lastname varchar(30)
  8037. , customizationcode varchar(3)
  8038. , password varchar(30)
  8039. , active varchar(1)
  8040. , inactivedate date
  8041. , lastcompany varchar(10)
  8042. , lookuplimit varchar(6)
  8043. , partiallookup varchar(1)
  8044. , implieddecimal varchar(1)
  8045. , autologoff varchar(1)
  8046. , inactivitytime varchar(3)
  8047. , enterkeyliketab varchar(1)
  8048. , inperiodend varchar(1)
  8049. , periodendprinter varchar(3)
  8050. , currentprinter varchar(3)
  8051. , lowspeedconnect varchar(1)
  8052. , systemdate date
  8053. , theme varchar(1)
  8054. , graphicreportformat varchar(1)
  8055. , reductionamountsinred varchar(1)
  8056. , promptforcompanycode varchar(1)
  8057. , usecrystalwebreports varchar(1)
  8058. , locked varchar(1)
  8059. , showhiddendialog varchar(1)
  8060. , external varchar(1)
  8061. , lockeddate numeric(15,4)
  8062. , lockedtime numeric(15,4)
  8063. , passworddate numeric(15,4)
  8064. , enablecsodbc varchar(1)
  8065. , appservspawn varchar(1)
  8066. , enablewebservicesforuser varchar(1)
  8067. , reportpreviewzoom numeric(15,4)
  8068. , surveyversion numeric(15,4)
  8069. , surveylaunchdate numeric(15,4)
  8070. , emailaddress varchar(250)
  8071. , jobtitle varchar(1)
  8072. , retainmoduleoncompanychange varchar(1)
  8073. , themecode varchar(20)
  8074. , CONSTRAINT rsy_userhistory_KEY0_pk PRIMARY KEY (userkey)
  8075. , CONSTRAINT rsy_userhistory_KEY0_check CHECK (userkey IS NOT NULL)
  8076. , CONSTRAINT rsy_userhistory_KEY1_unique UNIQUE (usercode)
  8077. , CONSTRAINT rsy_userhistory_KEY2_unique UNIQUE (userlogon)
  8078. ) WITH (OIDS=FALSE);
  8079. CREATE INDEX rsy_userhistory_KEY3_index ON sageimport.rsy_userhistory (securitykey);
  8080. CREATE INDEX rsy_userhistory_KEY4_index ON sageimport.rsy_userhistory (lastname,firstname);
  8081. CREATE INDEX rsy_userhistory_KEY5_index ON sageimport.rsy_userhistory (customizationcode,userkey);
  8082. CREATE INDEX rsy_userhistory_KEY6_index ON sageimport.rsy_userhistory (active,userlogon);
  8083. CREATE INDEX rsy_userhistory_KEY7_index ON sageimport.rsy_userhistory (external,active,userlogon);
  8084.  
  8085.  
  8086. CREATE TABLE sageimport.rsy_usersecurity(
  8087. userkey varchar(10)
  8088. , companykey varchar(10)
  8089. , rolekey varchar(10)
  8090. , startingdate date
  8091. , expirationdate date
  8092. , CONSTRAINT rsy_usersecurity_KEY0_pk PRIMARY KEY (userkey,companykey,rolekey)
  8093. , CONSTRAINT rsy_usersecurity_KEY0_check CHECK (userkey is not null and companykey is not null and rolekey IS NOT NULL)
  8094. ) WITH (OIDS=FALSE);
  8095. CREATE INDEX rsy_usersecurity_KEY1_index ON sageimport.rsy_usersecurity (userkey,rolekey,companykey);
  8096.  
  8097.  
  8098. CREATE TABLE sageimport.rsy_workstation(
  8099. workstationname varchar(30)
  8100. , userkey varchar(10)
  8101. , terminalid varchar(3)
  8102. , lastcompany varchar(10)
  8103. , currentprinter varchar(3)
  8104. , inperiodend varchar(1)
  8105. , periodendprinter varchar(3)
  8106. , lastactivitydate date
  8107. , lastactivitytime varchar(8)
  8108. , launcher numeric(15,4)
  8109. , CONSTRAINT rsy_workstation_KEY0_pk PRIMARY KEY (workstationname,userkey,terminalid)
  8110. , CONSTRAINT rsy_workstation_KEY0_check CHECK (workstationname is not null and userkey is not null and terminalid IS NOT NULL)
  8111. , CONSTRAINT rsy_workstation_KEY1_unique UNIQUE (terminalid)
  8112. ) WITH (OIDS=FALSE);
  8113.  
  8114.  
  8115. CREATE TABLE sageimport.rsy_zipcode(
  8116. zipcode varchar(10)
  8117. , city varchar(20)
  8118. , statecode varchar(2)
  8119. , countrycode varchar(3)
  8120. , CONSTRAINT rsy_zipcode_KEY0_pk PRIMARY KEY (zipcode)
  8121. , CONSTRAINT rsy_zipcode_KEY0_check CHECK (zipcode IS NOT NULL)
  8122. ) WITH (OIDS=FALSE);
  8123. CREATE INDEX rsy_zipcode_KEY1_index ON sageimport.rsy_zipcode (city,zipcode);
  8124. CREATE INDEX rsy_zipcode_KEY2_index ON sageimport.rsy_zipcode (statecode,zipcode);
  8125. CREATE INDEX rsy_zipcode_KEY3_index ON sageimport.rsy_zipcode (statecode,city,zipcode);
  8126.  
  8127.  
  8128. CREATE TABLE sageimport.rsy_zipcodeedit(
  8129. zipcode varchar(10)
  8130. , action varchar(1)
  8131. , city varchar(20)
  8132. , statecode varchar(2)
  8133. , countrycode varchar(3)
  8134. , CONSTRAINT rsy_zipcodeedit_KEY0_pk PRIMARY KEY (zipcode)
  8135. , CONSTRAINT rsy_zipcodeedit_KEY0_check CHECK (zipcode IS NOT NULL)
  8136. ) WITH (OIDS=FALSE);
  8137. CREATE INDEX rsy_zipcodeedit_KEY1_index ON sageimport.rsy_zipcodeedit (action);
  8138.  
  8139.  
  8140. CREATE TABLE sageimport.rsy0_companyparameters(
  8141. companycode varchar(3)
  8142. , reportdate date
  8143. , companyname varchar(35)
  8144. , companyaddress1 varchar(35)
  8145. , companyaddress2 varchar(35)
  8146. , companyaddress3 varchar(35)
  8147. , companyaddress4 varchar(35)
  8148. , telephonenumber varchar(10)
  8149. , federalidnumber varchar(15)
  8150. , glaccountsegment1 varchar(1)
  8151. , glaccountsegment2 varchar(1)
  8152. , glaccountsegment3 varchar(1)
  8153. , noglaccountingperiods varchar(2)
  8154. , glcurrentperiod varchar(2)
  8155. , glcalendaryear varchar(4)
  8156. , glfiscalyear varchar(4)
  8157. , glperiodenddate1 varchar(4)
  8158. , glperiodenddate2 varchar(4)
  8159. , glperiodenddate3 varchar(4)
  8160. , glperiodenddate4 varchar(4)
  8161. , glperiodenddate5 varchar(4)
  8162. , glperiodenddate6 varchar(4)
  8163. , glperiodenddate7 varchar(4)
  8164. , glperiodenddate8 varchar(4)
  8165. , glperiodenddate9 varchar(4)
  8166. , glperiodenddate10 varchar(4)
  8167. , glperiodenddate11 varchar(4)
  8168. , glperiodenddate12 varchar(4)
  8169. , glperiodenddate13 varchar(4)
  8170. , glsegment2desc varchar(15)
  8171. , glsegment3desc varchar(15)
  8172. , aprequiredivisions varchar(1)
  8173. , apagebydayormonth varchar(1)
  8174. , apagingcategory1 varchar(3)
  8175. , apagingcategory2 varchar(3)
  8176. , apagingcategory3 varchar(3)
  8177. , apagingcategory4 varchar(3)
  8178. , apcurrentperiod varchar(2)
  8179. , apcalendaryear varchar(4)
  8180. , apfiscalyear varchar(4)
  8181. , apextendedstub varchar(1)
  8182. , arrequiredivisions varchar(1)
  8183. , aragebydayormonth varchar(1)
  8184. , aragingcategory1 varchar(3)
  8185. , aragingcategory2 varchar(3)
  8186. , aragingcategory3 varchar(3)
  8187. , aragingcategory4 varchar(3)
  8188. , arcurrenteperiod varchar(2)
  8189. , arcalendaryear varchar(4)
  8190. , arfiscalyear varchar(4)
  8191. , imcurrentperiod varchar(2)
  8192. , imcalendaryear varchar(4)
  8193. , imfiscalyear varchar(4)
  8194. , imdecimalsinqty varchar(1)
  8195. , imdecimalsinprice varchar(1)
  8196. , imdecimalsincost varchar(1)
  8197. , imdecimalsinumconversion varchar(1)
  8198. , imcategory1desc varchar(15)
  8199. , imcategory2desc varchar(15)
  8200. , imcategory3desc varchar(15)
  8201. , imcategory4desc varchar(15)
  8202. , imincludewopoinqtyavail varchar(1)
  8203. , sopicksheetsort varchar(1)
  8204. , socurrentperiod varchar(2)
  8205. , socalendaryear varchar(4)
  8206. , sofiscalyear varchar(4)
  8207. , socustomertype1 varchar(4)
  8208. , socustomeroption1 varchar(1)
  8209. , socustomertype2 varchar(4)
  8210. , socustomeroption2 varchar(1)
  8211. , socustomertype3 varchar(4)
  8212. , socustomeroption3 varchar(1)
  8213. , socustomertype4 varchar(4)
  8214. , socustomeroption4 varchar(1)
  8215. , socustomertype5 varchar(4)
  8216. , socustomeroption5 varchar(1)
  8217. , socustomertype6 varchar(4)
  8218. , socustomeroption6 varchar(1)
  8219. , socustomertype7 varchar(4)
  8220. , socustomeroption7 varchar(1)
  8221. , socustomertype8 varchar(4)
  8222. , socustomeroption8 varchar(1)
  8223. , socustomertype9 varchar(4)
  8224. , socustomeroption9 varchar(1)
  8225. , socustomertype10 varchar(4)
  8226. , socustomeroption10 varchar(1)
  8227. , soprintbarcodeso varchar(1)
  8228. , soprintbarcodepicksheet varchar(1)
  8229. , pocurrentperiod varchar(2)
  8230. , pocalendaryear varchar(4)
  8231. , pofiscalyear varchar(4)
  8232. , poprtusageonreorderrpt varchar(1)
  8233. , podfltfobmessage varchar(15)
  8234. , poprtbarcodeonrect varchar(1)
  8235. , prdepartments varchar(1)
  8236. , prroundbenefithrsdays varchar(1)
  8237. , jccostcodesegment1 varchar(1)
  8238. , jccostcodesegment2 varchar(1)
  8239. , jccostcodesegment3 varchar(1)
  8240. , jcusesubjobs varchar(1)
  8241. , jcnodecimalplacesunitcost varchar(1)
  8242. , jcnodecimalplacesunitprice varchar(1)
  8243. , jcnodecimalplacesunit varchar(1)
  8244. , bmprintmisccodespicksheet varchar(1)
  8245. , bmprintcommentspicksheet varchar(1)
  8246. , wonewpagebystep varchar(1)
  8247. , wouserdefinedfielddesc1 varchar(15)
  8248. , wouserdefinedfielddesc2 varchar(15)
  8249. , wouserdefinedfielddesc3 varchar(15)
  8250. , wouserdefinedfielddesc4 varchar(15)
  8251. , jcpostwiptogl varchar(1)
  8252. , imenablewarrantytracking varchar(1)
  8253. , ranewsystem varchar(1)
  8254. , glmoduledate date
  8255. , apmoduledate date
  8256. , armoduledate date
  8257. , immoduledate date
  8258. , somoduledate date
  8259. , pomoduledate date
  8260. , prmoduledate date
  8261. , jcmoduledate date
  8262. , bmmoduledate date
  8263. , womoduledate date
  8264. , ramoduledate date
  8265. , CONSTRAINT rsy0_companyparameters_KEY0_pk PRIMARY KEY (companycode)
  8266. , CONSTRAINT rsy0_companyparameters_KEY0_check CHECK (companycode IS NOT NULL)
  8267. ) WITH (OIDS=FALSE);
  8268.  
  8269.  
  8270. CREATE TABLE sageimport.rsy0ste_nametocodexreffile(
  8271. name varchar(50)
  8272. , abbreviation varchar(5)
  8273. , CONSTRAINT rsy0ste_nametocodexreffile_KEY0_pk PRIMARY KEY (name)
  8274. , CONSTRAINT rsy0ste_nametocodexreffile_KEY0_check CHECK (name IS NOT NULL)
  8275. ) WITH (OIDS=FALSE);
  8276.  
  8277.  
  8278. CREATE TABLE sageimport.rsy1fax_faxformdefmasterfile(
  8279. formname varchar(6)
  8280. , formcode varchar(2)
  8281. , usercode varchar(3)
  8282. , companycode varchar(3)
  8283. , faxenabled varchar(1)
  8284. , sendto varchar(60)
  8285. , subject varchar(60)
  8286. , usecoverpage varchar(1)
  8287. , quickcover varchar(1)
  8288. , coverpagefile varchar(136)
  8289. , priority varchar(1)
  8290. , billcode varchar(30)
  8291. , key_words varchar(60)
  8292. , useoffpeak varchar(1)
  8293. , highresolution varchar(1)
  8294. , hold varchar(1)
  8295. , usecreditcard varchar(1)
  8296. , coverpagetext text
  8297. , CONSTRAINT rsy1fax_faxformdefmasterfile_KEY0_pk PRIMARY KEY (formname,formcode,usercode,companycode)
  8298. , CONSTRAINT rsy1fax_faxformdefmasterfile_KEY0_check CHECK (formname is not null and formcode is not null and usercode is not null and companycode IS NOT NULL)
  8299. ) WITH (OIDS=FALSE);
  8300.  
  8301.  
  8302. CREATE TABLE sageimport.rvi_defaultperform(
  8303. tablename varchar(30)
  8304. , performtype varchar(2)
  8305. , filetype varchar(1)
  8306. , columnname varchar(30)
  8307. , sequenceno varchar(3)
  8308. , jobtype varchar(1)
  8309. , performpath varchar(120)
  8310. , modulecode varchar(3)
  8311. , CONSTRAINT rvi_defaultperform_KEY0_pk PRIMARY KEY (tablename,performtype,filetype,columnname,sequenceno)
  8312. , CONSTRAINT rvi_defaultperform_KEY0_check CHECK (tablename is not null and performtype is not null and filetype is not null and columnname is not null and sequenceno IS NOT NULL)
  8313. ) WITH (OIDS=FALSE);
  8314.  
  8315.  
  8316. CREATE TABLE sageimport.rvi_jobexportelements(
  8317. jobname varchar(15)
  8318. , sequenceno varchar(4)
  8319. , linktablename varchar(30)
  8320. , columnname varchar(30)
  8321. , filetype varchar(1)
  8322. , datatype varchar(1)
  8323. , fieldtype varchar(1)
  8324. , class varchar(30)
  8325. , operationcode varchar(1)
  8326. , nsdmask varchar(50)
  8327. , sourceoriglength numeric(15,4)
  8328. , sourcesubstring varchar(1)
  8329. , sourcestartpos numeric(15,4)
  8330. , sourcelength numeric(15,4)
  8331. , exportcolpos numeric(15,4)
  8332. , exportfieldlength numeric(15,4)
  8333. , exportsubstring varchar(1)
  8334. , exportstartpos numeric(15,4)
  8335. , exportlength numeric(15,4)
  8336. , padwithspaces varchar(1)
  8337. , defaultvalue varchar(60)
  8338. , calcexpression text
  8339. , conditionalexpression text
  8340. , calculationonly varchar(1)
  8341. , runtimeprompt varchar(30)
  8342. , resettempvar varchar(1)
  8343. , partofodbcindex varchar(1)
  8344. , odbcfielddata varchar(60)
  8345. , odbcfieldtype varchar(10)
  8346. , libobjectname varchar(12)
  8347. , tablereferenceno varchar(2)
  8348. , CONSTRAINT rvi_jobexportelements_KEY0_pk PRIMARY KEY (jobname,sequenceno)
  8349. , CONSTRAINT rvi_jobexportelements_KEY0_check CHECK (jobname is not null and sequenceno IS NOT NULL)
  8350. ) WITH (OIDS=FALSE);
  8351. CREATE INDEX rvi_jobexportelements_KEY1_index ON sageimport.rvi_jobexportelements (columnname,jobname,sequenceno);
  8352.  
  8353.  
  8354. CREATE TABLE sageimport.rvi_jobexportselection(
  8355. jobname varchar(15)
  8356. , sequenceno varchar(4)
  8357. , linktablename varchar(30)
  8358. , columnname varchar(30)
  8359. , filetype varchar(1)
  8360. , datatype varchar(1)
  8361. , fieldtype varchar(1)
  8362. , class varchar(30)
  8363. , condition varchar(1)
  8364. , relation varchar(1)
  8365. , casesensitive varchar(1)
  8366. , charactermatch varchar(1)
  8367. , selectbegin varchar(60)
  8368. , selectend varchar(60)
  8369. , originalstartpos numeric(15,4)
  8370. , originallength numeric(15,4)
  8371. , substring varchar(1)
  8372. , startposition numeric(15,4)
  8373. , length numeric(15,4)
  8374. , userinput varchar(1)
  8375. , runtimeprompt varchar(30)
  8376. , rangestart text
  8377. , rangeend text
  8378. , selectionvalue text
  8379. , selectionmask text
  8380. , selectionlist text
  8381. , selectionseq text
  8382. , libobjectname varchar(12)
  8383. , tablereferenceno varchar(2)
  8384. , CONSTRAINT rvi_jobexportselection_KEY0_pk PRIMARY KEY (jobname,sequenceno)
  8385. , CONSTRAINT rvi_jobexportselection_KEY0_check CHECK (jobname is not null and sequenceno IS NOT NULL)
  8386. ) WITH (OIDS=FALSE);
  8387.  
  8388.  
  8389. CREATE TABLE sageimport.rvi_jobheader(
  8390. jobname varchar(15)
  8391. , jobtype varchar(1)
  8392. , compiledname varchar(6)
  8393. , jobcompiled varchar(1)
  8394. , currentstate varchar(1)
  8395. , usercode varchar(3)
  8396. , lastcompanycode varchar(3)
  8397. , tablename varchar(30)
  8398. , menuname varchar(40)
  8399. , joblongdescription varchar(240)
  8400. , fielddelimiter varchar(1)
  8401. , delimiterasciivalue varchar(3)
  8402. , importfilename varchar(120)
  8403. , importfiletype varchar(1)
  8404. , importfileonhost varchar(1)
  8405. , jobpassword varchar(7)
  8406. , nextjobchain varchar(15)
  8407. , waithours numeric(15,4)
  8408. , waitminutes numeric(15,4)
  8409. , executionloops numeric(15,4)
  8410. , currentexecutionloop numeric(15,4)
  8411. , insertrequiredfields varchar(1)
  8412. , insertallfields varchar(1)
  8413. , skipoverexistingrecords varchar(1)
  8414. , odbcdatasourcename varchar(60)
  8415. , datasourceonhost varchar(1)
  8416. , odbcloginusername varchar(15)
  8417. , odbcloginpassword varchar(15)
  8418. , datecreated date
  8419. , timecreated varchar(8)
  8420. , usercreatedkey varchar(10)
  8421. , dateupdated date
  8422. , timeupdated varchar(8)
  8423. , userupdatedkey varchar(10)
  8424. , separateheaderrecord varchar(1)
  8425. , convertdelimtospace varchar(1)
  8426. , padfieldswithspaces varchar(1)
  8427. , exportnamesasfirstrecord varchar(1)
  8428. , displayreadonlyfields varchar(1)
  8429. , wrapstringinquotes varchar(1)
  8430. , skipsourcedatatruncation varchar(1)
  8431. , CONSTRAINT rvi_jobheader_KEY0_pk PRIMARY KEY (jobname)
  8432. , CONSTRAINT rvi_jobheader_KEY0_check CHECK (jobname IS NOT NULL)
  8433. ) WITH (OIDS=FALSE);
  8434.  
  8435.  
  8436. CREATE TABLE sageimport.rvi_jobimportelements(
  8437. jobname varchar(15)
  8438. , sequenceno varchar(4)
  8439. , columnname varchar(30)
  8440. , datatype varchar(1)
  8441. , fieldtype varchar(1)
  8442. , filetype varchar(2)
  8443. , operationcode varchar(1)
  8444. , maskformat varchar(20)
  8445. , dateformatcode numeric(15,4)
  8446. , importcolumnno numeric(15,4)
  8447. , importstartpos numeric(15,4)
  8448. , importlength numeric(15,4)
  8449. , defaultvalue varchar(60)
  8450. , calcexpression text
  8451. , conditionalexpression text
  8452. , runtimeprompt varchar(30)
  8453. , resettempvar varchar(1)
  8454. , tableassignname varchar(30)
  8455. , tableassigncolumnname varchar(30)
  8456. , libobjectname varchar(12)
  8457. , importsubstring varchar(1)
  8458. , importfieldlength numeric(15,4)
  8459. , fieldsubstring varchar(1)
  8460. , fieldoriglength numeric(15,4)
  8461. , fieldstart numeric(15,4)
  8462. , fieldlength numeric(15,4)
  8463. , class varchar(30)
  8464. , assignsequence numeric(15,4)
  8465. , tablereferenceno varchar(2)
  8466. , CONSTRAINT rvi_jobimportelements_KEY0_pk PRIMARY KEY (jobname,sequenceno)
  8467. , CONSTRAINT rvi_jobimportelements_KEY0_check CHECK (jobname is not null and sequenceno IS NOT NULL)
  8468. ) WITH (OIDS=FALSE);
  8469. CREATE INDEX rvi_jobimportelements_KEY1_index ON sageimport.rvi_jobimportelements (columnname,jobname,sequenceno);
  8470.  
  8471.  
  8472. CREATE TABLE sageimport.rvi_options(
  8473. modulecode varchar(3)
  8474. , newsystem varchar(1)
  8475. , dataversion numeric(15,4)
  8476. , CONSTRAINT rvi_options_KEY0_pk PRIMARY KEY (modulecode)
  8477. , CONSTRAINT rvi_options_KEY0_check CHECK (modulecode IS NOT NULL)
  8478. ) WITH (OIDS=FALSE);
  8479.  
  8480.  
  8481. dsafasdfds
  8482.  
  8483.  
  8484.  
  8485.  
  8486.  
  8487.  
  8488.  
  8489.  
  8490.  
  8491.  
  8492.  
  8493.  
  8494.  
  8495.  
  8496.  
  8497.  
  8498.  
  8499.  
  8500.  
  8501.  
  8502.  
Tags: sql
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement