今天学习了一个新东东,从来没有用到过的.就是如题``````
根据列名查出表名有两种方法:
1. select b.[name] from syscolumns a inner join sysobjects b on a.[id]=b.[id] where a.[name]='列名' and b.type='U' order by b.[name]
2. SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE Column_name = '列名'
谢谢我的网友:笨笨熊,皮皮,星缘梦雨……
根据表名查出列名:
select name from syscolumns where id=object_id('表名')