Getting cdt data from a dse

Certified Senior Developer

I have an expression that takes in a dse and spits out the column names of everything in that dse. Unfortunately, the way it does this is by querying the dse and then running a!keys() on the first entry of the result to figure that all out. While this works perfectly well when the dse has values in it, it will error out if the table is empty. So is there any way to get the same information directly from a DSE that doesn't have data in it? 

  Discussion posts and replies are publicly visible

Parents
  • I haven't had a use case to do this with a DSE input, but I bet someone here will have a trick for you.

    Only thing I have done similar is created a view (MSSQL) based on the DB's underlying INFORMATION_SCHEMA.COLUMNS details.  Used primarily in our COE for debugging truncation errors (when we have slack on field length validations in the interface - older environment).  Then I have an interface where you can select the underlying table, and it will display all of the data points by column. 

    SELECT TOP (100) PERCENT ROW_NUMBER() OVER (ORDER BY TABLE_NAME) AS Row, 
    cast(TABLE_CATALOG as varchar(100)) 'server',
    cast(TABLE_SCHEMA as varchar(100)) 'schema',
    cast(TABLE_NAME as varchar(100)) 'tableName',
    cast(COLUMN_NAME as varchar(100)) 'columnName',
    cast(IS_NULLABLE as varchar(10)) 'nullable',
    cast(DATA_TYPE as varchar(100)) 'dataType',
    cast(CHARACTER_MAXIMUM_LENGTH as int) 'maxLength'
    FROM INFORMATION_SCHEMA.COLUMNS

Reply
  • I haven't had a use case to do this with a DSE input, but I bet someone here will have a trick for you.

    Only thing I have done similar is created a view (MSSQL) based on the DB's underlying INFORMATION_SCHEMA.COLUMNS details.  Used primarily in our COE for debugging truncation errors (when we have slack on field length validations in the interface - older environment).  Then I have an interface where you can select the underlying table, and it will display all of the data points by column. 

    SELECT TOP (100) PERCENT ROW_NUMBER() OVER (ORDER BY TABLE_NAME) AS Row, 
    cast(TABLE_CATALOG as varchar(100)) 'server',
    cast(TABLE_SCHEMA as varchar(100)) 'schema',
    cast(TABLE_NAME as varchar(100)) 'tableName',
    cast(COLUMN_NAME as varchar(100)) 'columnName',
    cast(IS_NULLABLE as varchar(10)) 'nullable',
    cast(DATA_TYPE as varchar(100)) 'dataType',
    cast(CHARACTER_MAXIMUM_LENGTH as int) 'maxLength'
    FROM INFORMATION_SCHEMA.COLUMNS

Children
No Data