在SQL Server 2005所有表中搜索某个指定列的方法
2009-02-16 17:11
330 查看
有时候我们只知道列的名字,但是不知道这列数据到底在哪个表里面,那么可以用下面的办法把含有这列数据的表查找出来。
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:1;
mso-generic-font-family:roman;
mso-font-format:other;
mso-font-pitch:variable;
mso-font-signature:0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-font-family:宋体;
mso-bidi-font-family:宋体;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-size:10.0pt;
mso-ansi-font-size:10.0pt;
mso-bidi-font-size:10.0pt;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
Select
O.name
objectName, C.name ColumnName from sys.columns C inner join sys.objects O ON C.object_id=O.object_id where C.name like '%ColumnName%'order by O.name, C.name
在你实际试用中,把ColumnName换成你要查的列的名字就可以了。
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:1;
mso-generic-font-family:roman;
mso-font-format:other;
mso-font-pitch:variable;
mso-font-signature:0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-font-family:宋体;
mso-bidi-font-family:宋体;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-size:10.0pt;
mso-ansi-font-size:10.0pt;
mso-bidi-font-size:10.0pt;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
Select
O.name
objectName, C.name ColumnName from sys.columns C inner join sys.objects O ON C.object_id=O.object_id where C.name like '%ColumnName%'order by O.name, C.name
在你实际试用中,把ColumnName换成你要查的列的名字就可以了。
相关文章推荐
- 在SQL Server 2005所有表中搜索某个指定列的方法
- SQL SERVER 2005中查询指定节点及其所有子节点的方法
- 【SQL精彩语句】SQL SERVER 2005中查询指定节点及其所有子节点的方法(表格形式显示)
- SQL SERVER 2005中查询指定节点及其所有父节点的方法
- vb搜索局域网内所有SQL Server服务器和指定SQL Server服务器上的所有数据库
- 用嵌套递归的方法搜索指定目录下的所有文件
- 删除指定表的所有索引,包括主键索引,唯一索引和普通索引 ,适用于sql server 2005,
- 删除指定表的所有索引,包括主键索引,唯一索引和普通索引 ,适用于sql server 2005,
- 删除指定表的所有索引,包括主键索引,唯一索引和普通索引 ,适用于sql server 2005 .
- 删除指定表的所有索引,包括主键索引,唯一索引和普通索引 ,适用于sql server 2005
- 删除指定表的所有索引,包括主键索引,唯一索引和普通索引 ,适用于sql server 2005 .
- 获取所有SQL Server 2005存储过程的简便方法
- SQL Server 2005安装配置方法图文教程 完美兼容Win7所有版本
- 从 SQL Server 2005 Beta 2 升级到 SQL Server 2005 社区技术预览后记录消息"无法找到指定的模块"错误和所有 SQL Server 代理作业不运行
- SQL Server 2005出现的游标错误的解决方法
- python获取指定目录下所有文件名列表的方法
- [ZT]SQL Server 2008实现"编辑所有行"和"返回所有行"的方法
- C#中拷贝指定文件夹下的所有文件夹目录到指定文件夹中的方法
- sql server 2005连接到服务器失败的解决方法
- C# 删除指定文件以及文件夹下的所有文件的方法