get DocumentId column from DocDM

Does anybody know how can I get the DocumentId property from a DocDM repository using SQL?. So far my SQL is like this:

SELECT name,email,gender FROM JSON_TABLE(
  'person',
  '$' COLUMNS(
    name VARCHAR(100) PATH '$.name',
    email VARCHAR(100) PATH '$.email',
    gender VARCHAR(2) PATH '$.gender'
  )

Thanks!

  • 0
  • 0
  • 179
  • 1
  • 1

Answers

The document ID is exposed implicitly as a virtual column named "_documentID". Here is a simple example that you can run in your SAMPLES namespace:

SELECT _documentID, Name, DOB, SSN FROM JSON_TABLE('People','$' %TYPE 'Sample.Document.People')