czchlong
czchlong

Reputation: 2574

How to find the underlying native data type of a Sybase custom data type?

I am using Sybase DB with TSQL.

I am able to view all the custom data types in my DB, however I cannot see the underlying native data type (INT, VARCHAR, CHAR, ...) that they wrap around.

The command I used was :

SELECT * FROM systypes

This displays all the custom data type names, but not their underlying native data types.

Does anyone know how I can view the native data type for custom data types in Sybase DB?

Thanks.

Upvotes: 2

Views: 1984

Answers (1)

aF.
aF.

Reputation: 66697

First add a type:

sp_addtype 'test', int
go

Then you have two possibilities.
Using sp_help:

sp_help 'test'
go


Or, at least for sybase 15.0.3, do the following query:

select s.name, st.name
from systypes s
inner join systypes st on s.type = st.type
where s.name = 'test'
and st.usertype < 100
go

Note, I made this query seeing the code in sp_help stored procedure. If you know there's a System SP that does part of what you want, just check its code at syssystemprocs database.

Upvotes: 4

Related Questions