我有这个代码:
select a.id as tableid,
a.name as tableName,
b.name as columnName,
b.status as columnStatus,
b.type as columnType
from sysobjects a
LEFT JOIN syscolumns b
ON a.id = b.id
WHERE a.name = 'table_name'
Run Code Online (Sandbox Code Playgroud)
现在,columType显示数字.我想获取columnType的名称,该名称位于表'systypes'中的'name'列中.我怎么做?简单的LEFT JOIN将导致重复的行.
aF.*_*aF. 10
我在Sybase 15.0中看到过,这是你必须使用的代码:
select o.id [tableid], o.name [tableName], c.name [columnName], c.status [columnStatus], t.name [columnType] from sysobjects o
inner join syscolumns c on c.id = o.id
inner join systypes t on t.usertype = c.usertype
where o.type = 'U' and o.name in ('tablename')
Run Code Online (Sandbox Code Playgroud)