Please be aware that the SAP SQL Anywhere Forum will be shut down on August 29th, 2024 when all it's content will be migrated to the SAP Community.

Is there a way to return a list of Column names, data types and if they have default values what they are?

I can get the Column names like this...

select c.column_name
from systabcol c 
key join systab t on t.table_id=c.table_id 
where t.table_name='tablename'

... but it would be really useful to be able also return the data types and if they have a default value or not


Figured out I can get the Column Name, Type, Nullable and Primary Key with


Just need to find a way to return the default value and I've cracked the job!

Thank you

asked 19 Feb '17, 10:35

gchq's gravatar image

accept rate: 36%

edited 19 Feb '17, 10:41


permanent link

answered 19 Feb '17, 11:20

Breck%20Carter's gravatar image

Breck Carter
accept rate: 20%

That got me on the correct path - this gives me all I need

select  *
from systabcol key join systab
where table_name = 'Customers';
(19 Feb '17, 11:38) gchq

What is max_identity? It seems to appear for autoincrement primary key columns (e.g. 44) whilst others are zero....

(19 Feb '17, 15:54) gchq
Replies hidden

Yes, that's for (global) autoincrement defaults - which need not to be primary keys. Cf. that FAQ...

(19 Feb '17, 16:32) Volker Barth
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 19 Feb '17, 10:35

question was seen: 1,476 times

last updated: 19 Feb '17, 16:34