如何保存字段别名? [英] How do I save field alias?

查看:80
本文介绍了如何保存字段别名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我可以在sql中保存字段别名并在c#中使用它吗?



我尝试了什么:



............................... .................................................. ..

Hi
Can i save field alias in sql and use it in c#?

What I have tried:

...................................................................................

推荐答案

您没有保存别名 - 它们是列的临时名称,在命令完成时会被丢弃。

但是,如果您的别名是SELECT语句中列规范的一部分:

You don't "save" aliases - they are a temporary name for a column which is discarded when the command is finished.
However, if your alias is part of the column specification in a SELECT statement:
SELECT ID, theVeryLongNameIDontWantToSee AS UName FROM MyTable

然后两列返回到您的C#应用程序将是ID和UName,而不是ID和theVeryLongNameIDontWantToSee。

Then the two columns returned to your C# application would be "ID" and "UName", not "ID" and "theVeryLongNameIDontWantToSee".


这篇关于如何保存字段别名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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