---
title: "sqlserver 中查询一个字段都在哪个表中"
author: "dky_rl"
date: "2009-12-30T16:36:48Z"
tags: []
categories: ["数据库"]
slug: "sqlserver"
draft: false
lastmod: "2009-12-30T16:36:48Z"
id: 559859
url: "https://rosela.iteye.com/blog/559859"
---

要在数据库中查找cost_center都在什么表中用到了，
首先用连接到要查找的数据库，不能用windows验证方式。



select * from  syscolumns 
where name = 'cost_center'

查询出name 如下：
4195065
1698105090

把name 放到如下语句中执行：
select * from sysobjects
where id=4195065

结果中的name 就是要找的表了：
VW_Employee