Search code examples
sqlsybaseshortcutuser-defined-types

SELECT all of a user-defined datatype/structure


Is there a shortcut to selecting all the components of a user-defined datatype/structure in SYBASE 10?

So if Resrv is a field based on a user-defined datatype/structure, something like:

 SELECT Name, Resrv from AGC_AREAPARM

(which doesn't work)

Note: SELECT Name, * from AGC_AREAPARM doesn't work either.

What does work is specifying each child item, like:

 SELECT Name, Resrv.SysReqOper, Resrv.SysReqSpin from AGC_AREAPARM

EDIT : If anyone can give me the correct verbiage for the structure, that'd be great. I'm having a hard time finding it in the Sybase documentation.

Here's a pic of some of the sp_helptype output, AGC_RESERVE is the type for the Resrv field:

sphelptype


Solution

  • First, what you are seeing is definitely not something created via the Create Domain or Create DataType predicate. Per the documentation:

    Domains are aliases for built-in data types, including precision and scale values where applicable. They improve convenience and encourage consistency in the database. *

    Instead, my guess is that you are using is a Java class (which sp_helptype shows as a structure). There is no mechanism using the Sybase SQL dialect to natively select all properties of a class. You must explicitly declare them in your Select statement:

    Select Name
        , Resrv.SysRegOper
        , Resrv.SysRegSpin
    From Table