Just a slight issue:
Something I frequently need: a comma-separated list of all column names ordered by column id (i.e. position) for one particular table, and I'm usually needing it while writing (ad-hoc) SQL code - so I'm not asking for a Sybase Central wizard approach:)
I'm using this frequently to build "SELECT col1 ... coln FROM MyTable ... " statements or the like.
Is there any builtin function - or anything better than the catalog query I'm about to post?
What I'm typically using is something like the following:
select list (column_name, ', ' order by column_id) from systabcol key join systab where table_name = 'MyTableName';
Works fine for v10 and above (and I'm posting it here to remind me of that tiny template), but I guess there are better builtin ways...
answered 09 Jul '12, 09:58
I've used this approach before:
You'll get two rows. Top row is column names. Bottom row is data. Delete data and you have a comma separated list of column names.
answered 30 Jul '12, 06:39