Reputation: 402
I am trying to get schema of existing database using this query in sybase iq 15.4 -
SELECT t.name AS TABLE_NAME, col.name AS column_name
FROM sysobjects t
JOIN syscolumns col ON t.id=col.id
WHERE t.TYPE='U'
I am getting an error "syscolumns is ambigous" so I resolved this error by changing the syntax -
SELECT t.name AS TABLE_NAME, col.name AS column_name
FROM sysobjects t
JOIN sys.syscolumns col ON t.id=col.id
WHERE t.TYPE='U'
After that I am getting an error "Column id not found". Can you please help me to use this query to get the column for join on other column.
Thanks In Advance!!
Upvotes: 1
Views: 2970
Reputation: 402
We can use this query as -
SELECT t.name AS TABLE_NAME, col.cname AS column_name
FROM sysobjects t
JOIN sys.syscolumns col ON t.name =col.tname
WHERE t.TYPE='U'
Upvotes: 2