Created
November 16, 2017 14:11
-
-
Save ableasdale/40e96b56a96b3c2dee48c3832b5ad31e to your computer and use it in GitHub Desktop.
MarkLogic: Create a simple template to map documents to an SQL view (Article-511)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
import module namespace tde = "http://marklogic.com/xdmp/tde" | |
at "/MarkLogic/tde.xqy"; | |
let $employees := | |
<template xmlns="http://marklogic.com/xdmp/tde"> | |
<context>/Employee</context> | |
<rows> | |
<row> | |
<schema-name>main</schema-name> | |
<view-name>employees</view-name> | |
<columns> | |
<column> | |
<name>EmployeeID</name> | |
<scalar-type>int</scalar-type> | |
<val>ID</val> | |
</column> | |
<column> | |
<name>FirstName</name> | |
<scalar-type>string</scalar-type> | |
<val>FirstName</val> | |
</column> | |
<column> | |
<name>LastName</name> | |
<scalar-type>string</scalar-type> | |
<val>LastName</val> | |
</column> | |
<column> | |
<name>Position</name> | |
<scalar-type>string</scalar-type> | |
<val>Position</val> | |
</column> | |
</columns> | |
</row> | |
</rows> | |
</template> | |
return tde:template-insert("/employees.xml", $employees) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment