Is there any way of saving the result set of a SYSTEM procedure in Sybase ASE 15?
For example, if i want to get details about all the columns of a table, i would use the following code:
sp_columns 'TABLE_NAME'
.
I want to save the result into a temporary table or get it by using a cursor to use it for other queries. Is there any way of doing it?
Note: I am aware i could write my query by using the system tables and get the same result, but if this is possible, i would prefer this method.
The system stored procedures are not intended to be used for inputs into other tables/procedures.
If you don't want to write your own queries, you can look at the code behind the stored procedure by using sp_helptext
. For system stored procedures you need to be in the sybsystemprocs
db.
use sybsystemprocs
go
sp_helptext sp_columns
go
From there you can take a look at what is being queried and just grab what you need.
It's also helpful to take a look at the Sybase ASE System Tables Diagram: This shows all the system tables, and all the relationships between tables.