如何根据字段的数据在sql server 2005中检索表的字段名 [英] how to retrive the fieldname of the table in sql server 2005 based on the data of the field

查看:86
本文介绍了如何根据字段的数据在sql server 2005中检索表的字段名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有两个表table1和table2.ie,

表1
名姓中间名
角斗士战士
FF HBO y2k

表2
姓名地址PhNo
美国角斗士99999
HBO IND 89899

我必须检索两个表的列名,其中
具有共同数据的数据,例如:角斗士,HBO

注意:我不知道两个表的列名称.



I have two tables table1 and table2.ie,

TABLE1
firstname lastname middlename
the gladiator warrior
FF HBO y2k

TABLE2
name address PhNo
gladiator USA 99999
HBO IND 89899

I have to retrive the column name of the two tables where
data having common data i.e:gladiator,HBO

Note: I dont know the column names of the two tables

推荐答案

..

您可以使用别名在查询中检索Filedname.

示例:

选择< columnname>作为< aliasname>来自< tablename>

别名是USerDefined简单名称...

希望它对您的要求.
Hi,..

You can use alias name for retrieving the Filedname in the Query.

Example:

select <columnname> as <aliasname> from <tablename>

Aliasname is USerDefined Simple Name...

Hope its ur REquirement.


这篇关于如何根据字段的数据在sql server 2005中检索表的字段名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆