cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Sap.Data.SQLAnywhere.SAException (0x80004005): Procedure 'Describe' not found

gchg
Explorer
0 Likes
787

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)

 

Accepted Solutions (1)

Accepted Solutions (1)

VolkerBarth
Contributor

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.

gchg
Explorer
0 Likes
Thank you, Volker - that is just what I needed.

Answers (0)