scr*_*Owl 6 python mysql sql sql-server parsing
如果我有一个SQL脚本,那么有一种方法可以通过提取所使用的列和引用到表中的表,如下所示:
脚本:
Select t1.first, t1.last, t2.car, t2.make, t2.year
from owners t1
left join cars t2
on t1.owner_id = t2.owner_id
Run Code Online (Sandbox Code Playgroud)
输出:
Table Column
owners first
owners last
owners owner_id
cars car
cars make
cars year
cars owner_id
Run Code Online (Sandbox Code Playgroud)
这就是您在 SQL Server 中想要的:
select t.name as [Table], c.name as [Column]
from sys.columns c
inner join sys.tables t
on c.object_id = t.object_idRun Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1212 次 |
| 最近记录: |