on ‎2025 Feb 06 10:50 AM
Hi
If I run - Describe TableName - in Interactive SQL it returns the column name, type, nullable and Primary Key - but when running the same from a .NET app it throws the above error. The full text of the error is below. Any ideas?
Thanks
Sap.Data.SQLAnywhere.SAException (0x80004005): Procedure 'Describe' not found
at Sap.Data.SQLAnywhere.SACommand._ExecuteReader(CommandBehavior commandBehavior, Boolean isExecuteScalar, Boolean isBeginExecuteReader)
at Sap.Data.SQLAnywhere.SACommand.ExecuteReader()
at Sap.Data.SQLAnywhere.SADataAdapter.OpenDataReader(Boolean schemaOnly, Boolean& closeConnection, SACommand selectCommand)
at Sap.Data.SQLAnywhere.SADataAdapter.OpenDataReader(Boolean schemaOnly, Boolean& closeConnection)
at Sap.Data.SQLAnywhere.SADataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
Request clarification before answering.
AFAIK, DESCRIBE is an DBISQL resp. Embedded SQL statement and as such not available for generic database APIs like ODBC or ADO.Net.
As you have suggested, a query on SYS.SYSTABCOL should reveal all details, such as
select SC.*
from SYS.SYSTAB ST key join SYS.SYSTABCOL SC
where ST.table_name = 'MyTableName'
order by column_id
SYSTABCOL column "column_type" does tell whether a column is computed or not (C=computed column, and R=other columns), and a default ist marked with "R".
Addionally, you can use builtin stored procedures like sa_decribe_query() to query the result set of arbitrary queries resp. sa_get_table_definition() to get the full CREATE TABLE statement for a table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 14 | |
| 9 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.