Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1558
  • Last Modified:

How to get column definition of a table from systables

I want to get column definition of a table through system tables but I am finding it hard.  I want to know datatype,length and if it allows null values are not.

Looks like one type in syscolumns is mapping to multiple columns in systypes. I am not sure how to get uniq type any idea( I tried user_type but didn't work)
0
koppcha
Asked:
koppcha
1 Solution
 
alpmoonCommented:
You should use usertype for only user defined datatypes and type for all others. If you are trying to write a query for that, user defined datatypes have always a type number higher than 100. So you can join with systypes two times one for usertype < 100 and the other for usertype > 100. Former join will be based on type and the latter join will be based on usertype.

0
 
Joe WoodhousePrincipal ConsultantCommented:
Is this Sybase ASE? If so, have a look at sp_help in sybsystemprocs, it has good SQL for getting the column structure.
0
 
koppchaAuthor Commented:
It worked great. I just forgot that i could check system procs. Thanks
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now