?
Solved

How to get column definition of a table from systables

Posted on 2010-01-12
3
Medium Priority
?
1,546 Views
Last Modified: 2012-05-08
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
Comment
Question by:koppcha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 13

Expert Comment

by:alpmoon
ID: 26299019
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
 
LVL 24

Accepted Solution

by:
Joe Woodhouse earned 2000 total points
ID: 26301769
Is this Sybase ASE? If so, have a look at sp_help in sybsystemprocs, it has good SQL for getting the column structure.
0
 
LVL 8

Author Closing Comment

by:koppcha
ID: 31676410
It worked great. I just forgot that i could check system procs. Thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Check out the latest tech news, community articles, and expert highlights in August's newsletter.
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question