本文介绍了SQL服务器,这些选择的性能和差异是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我正在寻找一种在给定数据库中查找的方法,如果有一个表符合特定名称的列。经过研究和与同事交谈后,出现了两种可能的解决方案:



Hello,

I was looking into a way to find in a given database if there were any table if a column that matched a specific name. After researching and talking to colleagues these two possible solution have arisen:

SELECT
	table_name
	,column_name 
FROM
	information_schema.columns
WHERE
	column_name like '%word%'






And

SELECT
	t.name AS TableName
	,c.name AS ColName
FROM 
	sys.columns c
JOIN 
	sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%word%'





它们之间是否存在性能差异?什么时候?有关如何改进它的任何建议吗?



thx



Is there a performance difference between them? when? Any suggestions on how to improve it?

thx

推荐答案


这篇关于SQL服务器,这些选择的性能和差异是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 16:02