Drive an incremental load from a SQL Server rowversion column
A SQL Server rowversion (also called timestamp) column is a good incremental key: it is an 8-byte binary value that the database increments automatically every time the row is inserted or updated. Kodda stores the last value read in its metadata repository as text, so the column must be converted to a string for the incremental value, and converted back to binary at run time so the source query can use the index on the column.The mapping Std.Snowflake.MSSQL.cust.cand_master below reads the cust.candidate table, which has a rowversion column named RowVer.
In Mapping Details, set the Load Type to an incremental type (here Incremental Insert/Update) and, under Incremental Load Properties, set Incremental Column to <CustomExpression> with the expression:
This converts the binary row version to its hexadecimal string form (for example 0x00000000000017D4), which is what Kodda keeps as the Next Incremental Value after each run.
Comparing the string form against the column would prevent SQL Server from using the index on RowVer. Use the $incremental_ss_binary(<column>)$ function in the Source SQL instead:
The lower bound is the Next Incremental Value from the previous run, compared with the Incremental Operator (> or >=).
The upper bound is the maximum row version in the source at the start of the run, so rows changed while the load is in progress are picked up by the next run.
On the first run, when there is no stored value, the condition evaluates to 1 = 1 and the whole table is read.
$incremental_ss_binary()$ is SQL Server specific. For other databases, or for numeric and date incremental columns, use the generic $incremental(<column>)$ function, which compares the values directly.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"CaO_Data_Platform (KODDA)","colors":{"primary":"#0D9373","light":"#55D799","dark":"#0D9373"},"favicon":"https://mintcdn.com/cao-analytics-llc/B5wMHzLeDwC7dAu1/favicon.png?fit=max\u0026auto=format\u0026n=B5wMHzLeDwC7dAu1\u0026q=85\u0026s=c0913a81e12ce0373fb78551999d4e28","navbar":{"links":[{"href":"http://apidocs.caoanalytics.com","label":"API Docs"}]},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"cao-analytics-llc","hasAudioNarration":false,"actualSubdomain":"cao-analytics-llc","customDomains":["docs.caoanalytics.com"],"gitSource":{"type":"github","owner":"congstad","repo":"kodda_docs_mintlify","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":"","_id":"6aebf2923e1949090240deeb"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6aef3acfec2091b7c464c782","clientVersion":"0.0.4076","searchFilterCounts":[{"language":"default","tag":"Documentation","count":30},{"language":"default","tag":"User Guide","count":17},{"language":"default","tag":"Getting Started","count":7},{"language":"default","tag":"Edit Mapping","count":4},{"language":"default","tag":"Examples","count":3},{"language":"default","tag":"Generate Mapping","count":3}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"examples/incremental-loads-using-row-version","slug":"/examples/incremental-loads-using-row-version","pageMetadata":{"title":"Incremental Loads Using Row Version","description":"Drive an incremental load from a SQL Server rowversion column","href":"/examples/incremental-loads-using-row-version"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Drive an incremental load from a SQL Server rowversion column\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,em:`em`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,OptimizedImage,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`A SQL Server `,_jsx(_components.code,{children:`rowversion`}),` (also called `,_jsx(_components.code,{children:`timestamp`}),`) column is a good incremental key: it is an 8-byte binary value that the database increments automatically every time the row is inserted or updated. Kodda stores the last value read in its metadata repository as text, so the column must be converted to a string for the incremental value, and converted back to binary at run time so the source query can use the index on the column.`]}),`\n`,_jsxs(_components.p,{children:[`The mapping `,_jsx(_components.code,{children:`Std.Snowflake.MSSQL.cust.cand_master`}),` below reads the `,_jsx(_components.code,{children:`cust.candidate`}),` table, which has a `,_jsx(_components.code,{children:`rowversion`}),` column named `,_jsx(_components.code,{children:`RowVer`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`1-store-the-row-version-as-a-string`,children:`1. Store the row version as a string`}),`\n`,_jsxs(_components.p,{children:[`In `,_jsx(_components.strong,{children:`Mapping Details`}),`, set the `,_jsx(_components.strong,{children:`Load Type`}),` to an incremental type (here `,_jsx(_components.em,{children:`Incremental Insert/Update`}),`) and, under `,_jsx(_components.strong,{children:`Incremental Load Properties`}),`, set `,_jsx(_components.strong,{children:`Incremental Column`}),` to `,_jsx(_components.code,{children:`\u003cCustomExpression>`}),` with the expression:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`convert`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`varchar`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`20`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`), `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`convert`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`varbinary`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`8`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`), [RowVer]), `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`This converts the binary row version to its hexadecimal string form (for example `,_jsx(_components.code,{children:`0x00000000000017D4`}),`), which is what Kodda keeps as the `,_jsx(_components.strong,{children:`Next Incremental Value`}),` after each run.`]}),`\n`,_jsx(`div`,{align:`left`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-incremental-properties.png?fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=c49b10d54ff8fb6092e460a7a5e54b54`,alt:``,width:`600`,\"data-og-width\":`1200`,\"data-og-height\":`800`,\"data-path\":`images/rowversion-incremental-properties.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-incremental-properties.png?w=280\u0026fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=7929660750f49fe3fa32091bba33854b 280w, https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-incremental-properties.png?w=560\u0026fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=8f586e6a054fa97a546eb2000203d2cc 560w, https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-incremental-properties.png?w=840\u0026fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=53ca646e435eb7d7d2308a481e166cfb 840w, https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-incremental-properties.png?w=1100\u0026fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=43b5943922d093a9b0a7372f07711596 1100w, https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-incremental-properties.png?w=1650\u0026fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=4adf76397fad95a74933ecb72aead0bf 1650w, https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-incremental-properties.png?w=2500\u0026fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=98fcedef4a51c4c5b38387304e3cb0e4 2500w`})}),`\n`,_jsx(Heading,{level:`2`,id:`2-compare-as-binary-at-run-time`,children:`2. Compare as binary at run time`}),`\n`,_jsxs(_components.p,{children:[`Comparing the string form against the column would prevent SQL Server from using the index on `,_jsx(_components.code,{children:`RowVer`}),`. Use the `,_jsx(_components.code,{children:`$incremental_ss_binary(\u003ccolumn>)$`}),` function in the `,_jsx(_components.strong,{children:`Source SQL`}),` instead:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`select`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [cand_id], [cand_name], ..., [year], [RowVer]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [cust].[candidate]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`where`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` $incremental_ss_binary([RowVer])$`})]}),`\n`]})})}),`\n`,_jsx(`div`,{align:`left`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-source-sql.png?fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=54deff49918eecdeb5eac3bba77c6118`,alt:``,width:`640`,\"data-og-width\":`2530`,\"data-og-height\":`930`,\"data-path\":`images/rowversion-source-sql.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-source-sql.png?w=280\u0026fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=89e22bb463f2f52e2de241e2edb79d7f 280w, https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-source-sql.png?w=560\u0026fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=117711a79a366c55342c190ad5a4fe8b 560w, https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-source-sql.png?w=840\u0026fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=af79b5e07ce32f67be15f395c0ca982f 840w, https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-source-sql.png?w=1100\u0026fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=9e7f2ed39d8cb04dafbb56c3b9b74909 1100w, https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-source-sql.png?w=1650\u0026fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=abe4f3bcd84aec9e528078ce7e49d21d 1650w, https://mintcdn.com/cao-analytics-llc/LFV2nc6dB8bo5mNA/images/rowversion-source-sql.png?w=2500\u0026fit=max\u0026auto=format\u0026n=LFV2nc6dB8bo5mNA\u0026q=85\u0026s=5bd5fa65a129dbe792b882a1a1fdb7a6 2500w`})}),`\n`,_jsx(_components.p,{children:`When the mapping runs, Kodda replaces the function with a binary comparison using the stored value, for example:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`( [RowVer] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` convert`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`varbinary`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(max), `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x00000000000017D4'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` and`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [RowVer] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` convert`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`varbinary`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(max), `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x0000000000001A2F'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) )`})]}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`The lower bound is the `,_jsx(_components.strong,{children:`Next Incremental Value`}),` from the previous run, compared with the `,_jsx(_components.strong,{children:`Incremental Operator`}),` (`,_jsx(_components.code,{children:`>`}),` or `,_jsx(_components.code,{children:`>=`}),`).`]}),`\n`,_jsx(_components.li,{children:`The upper bound is the maximum row version in the source at the start of the run, so rows changed while the load is in progress are picked up by the next run.`}),`\n`,_jsxs(_components.li,{children:[`On the first run, when there is no stored value, the condition evaluates to `,_jsx(_components.code,{children:`1 = 1`}),` and the whole table is read.`]}),`\n`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`$incremental_ss_binary()$`}),` is SQL Server specific. For other databases, or for numeric and date incremental columns, use the generic `,_jsx(_components.code,{children:`$incremental(\u003ccolumn>)$`}),` function, which compares the values directly.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Incremental Loads Using Row Version","description":"Drive an incremental load from a SQL Server rowversion column","href":"/examples/incremental-loads-using-row-version"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"1. Store the row version as a string","slug":"1-store-the-row-version-as-a-string","depth":2,"children":[]},{"title":"2. Compare as binary at run time","slug":"2-compare-as-binary-at-run-time","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"cao-analytics-llc","siteName":"CaO_Data_Platform (KODDA)","title":"Incremental Loads Using Row Version - CaO_Data_Platform (KODDA)","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-05T20:55:16.267Z","originalFileLocation":"examples/incremental-loads-using-row-version.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Drive an incremental load from a SQL Server rowversion column\">\u003cmeta data-mint-head name=\"application-name\" content=\"CaO_Data_Platform (KODDA)\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/cao-analytics-llc/VnvqKJY5XZvKbAmr/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/cao-analytics-llc/VnvqKJY5XZvKbAmr/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/cao-analytics-llc/VnvqKJY5XZvKbAmr/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/cao-analytics-llc/VnvqKJY5XZvKbAmr/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/cao-analytics-llc/VnvqKJY5XZvKbAmr/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/cao-analytics-llc/VnvqKJY5XZvKbAmr/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/cao-analytics-llc/VnvqKJY5XZvKbAmr/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/cao-analytics-llc/VnvqKJY5XZvKbAmr/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/cao-analytics-llc/VnvqKJY5XZvKbAmr/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Incremental Loads Using Row Version - CaO_Data_Platform (KODDA)\">\u003cmeta data-mint-head property=\"og:description\" content=\"Drive an incremental load from a SQL Server rowversion column\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"CaO_Data_Platform (KODDA)\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.caoanalytics.com/examples/incremental-loads-using-row-version\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://cao-analytics-llc.mintlify.site/_mintlify/api/og/v2?division=Examples\u0026amp;title=Incremental+Loads+Using+Row+Version\u0026amp;description=Drive+an+incremental+load+from+a+SQL+Server+rowversion+column\u0026amp;theme=08f71a11b2a1fddfe6ddd773\u0026amp;signature=0b06674a1e9c70c7180e54be22be3459a1af22fc14e67e14d5ffff747459455e\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Incremental Loads Using Row Version - CaO_Data_Platform (KODDA)\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Drive an incremental load from a SQL Server rowversion column\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://cao-analytics-llc.mintlify.site/_mintlify/api/og/v2?division=Examples\u0026amp;title=Incremental+Loads+Using+Row+Version\u0026amp;description=Drive+an+incremental+load+from+a+SQL+Server+rowversion+column\u0026amp;theme=08f71a11b2a1fddfe6ddd773\u0026amp;signature=0b06674a1e9c70c7180e54be22be3459a1af22fc14e67e14d5ffff747459455e\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/cao-analytics-llc/VnvqKJY5XZvKbAmr/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"CaO_Data_Platform (KODDA)\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0D9373\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.caoanalytics.com/examples/incremental-loads-using-row-version\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/examples/incremental-loads-using-row-version.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.caoanalytics.com/#organization\",\"name\":\"CaO_Data_Platform (KODDA)\",\"url\":\"https://docs.caoanalytics.com\"},{\"@type\":\"WebSite\",\"@id\":\"https://docs.caoanalytics.com#website\",\"name\":\"CaO_Data_Platform (KODDA)\",\"url\":\"https://docs.caoanalytics.com\",\"publisher\":{\"@id\":\"https://docs.caoanalytics.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.caoanalytics.com/examples/incremental-loads-using-row-version#webpage\",\"url\":\"https://docs.caoanalytics.com/examples/incremental-loads-using-row-version\",\"name\":\"Incremental Loads Using Row Version\",\"description\":\"Drive an incremental load from a SQL Server rowversion column\",\"dateModified\":\"2026-11-05T20:55:16.267Z\",\"isPartOf\":{\"@id\":\"https://docs.caoanalytics.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.caoanalytics.com/examples/incremental-loads-using-row-version#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.caoanalytics.com/examples/incremental-loads-using-row-version#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Documentation\",\"item\":\"https://docs.caoanalytics.com/introduction\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Examples\",\"item\":\"https://docs.caoanalytics.com/examples\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Incremental Loads Using Row Version\",\"item\":\"https://docs.caoanalytics.com/examples/incremental-loads-using-row-version\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.caoanalytics.com/examples/incremental-loads-using-row-version#article\",\"headline\":\"Incremental Loads Using Row Version\",\"name\":\"Incremental Loads Using Row Version\",\"description\":\"Drive an incremental load from a SQL Server rowversion column\",\"url\":\"https://docs.caoanalytics.com/examples/incremental-loads-using-row-version\",\"mainEntityOfPage\":{\"@id\":\"https://docs.caoanalytics.com/examples/incremental-loads-using-row-version#webpage\"},\"dateModified\":\"2026-11-05T20:55:16.267Z\",\"publisher\":{\"@id\":\"https://docs.caoanalytics.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.caoanalytics.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"CaO_Data_Platform (KODDA)\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"CaO_Data_Platform (KODDA)","nav":{"global":null,"groups":[{"group":"Documentation","pages":[{"title":"Introduction","href":"/introduction"},{"group":"Getting Started","pages":[{"title":"Getting Started","href":"/getting-started"},{"title":"Login Screen","href":"/getting-started/login-screen"},{"title":"Home Screen","href":"/getting-started/homepage"},{"title":"Manage Users","href":"/getting-started/manage-users"},{"title":"Manage Connections","href":"/getting-started/manage-connections"},{"title":"API Keys","href":"/getting-started/api-keys"},{"title":"User Interface","href":"/getting-started/user-interface"}]},{"group":"User Guide","pages":[{"title":"User Guide","href":"/user-guide"},{"group":"Generate Mapping","pages":[{"title":"Generate Mapping","href":"/user-guide/generate-mapping"},{"title":"Data Type Mappings","href":"/user-guide/generate-mapping/data-type-mappings"},{"title":"Generate Results","href":"/user-guide/generate-mapping/generate-results"}]},{"group":"Edit Mapping","pages":[{"title":"Edit Mapping","href":"/user-guide/edit-mapping"},{"title":"Mapping Details","href":"/user-guide/edit-mapping/mapping-details"},{"title":"Mapping Elements","href":"/user-guide/edit-mapping/mapping-elements"},{"title":"Mapping Activities","href":"/user-guide/edit-mapping/mapping-activities"}]},{"title":"Design Workflow","href":"/user-guide/design-workflow"},{"title":"Scheduler","href":"/user-guide/schedule-job"},{"title":"Browse Data","href":"/user-guide/browse-data"},{"title":"Map History","href":"/user-guide/mapping-history"},{"title":"Workflow History","href":"/user-guide/workflow-history"},{"title":"Upload Files","href":"/user-guide/upload-files"},{"title":"Migrate Objects","href":"/user-guide/migrate"},{"title":"Google Analytics","href":"/user-guide/google-analytics"},{"title":"Data Dictionary","href":"/user-guide/data-dictionary"}]},{"title":"Architecture Guide","href":"/architecture-guide"},{"title":"Release Notes","href":"/release-notes"},{"group":"Examples","pages":[{"title":"Loading Files From S3","href":"/examples"},{"title":"Incremental Change Tracking","description":"Load inserts, updates and deletes from SQL Server using Change Tracking","href":"/examples/incremental-change-tracking"},{"title":"Incremental Loads Using Row Version","href":"/examples/incremental-loads-using-row-version"}]}]}]},"basePath":"","title":"Incremental Loads Using Row Version - CaO_Data_Platform (KODDA)","buildId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","deploymentId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-DMoL6lHz.js","lightbox-handle-r17bVUz3.js"]}