SQL Server:选择前 0? [英] SQL Server: Select Top 0?
本文介绍了SQL Server:选择前 0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们刚刚在旧的生产存储过程中遇到了这个问题(这里还有很多事情要做,但这只是其逻辑的一个方面).为什么有人会从表中选择前 0 行?这是我不熟悉的某种 SQL hack 或技巧吗?
We just came across this in an old production stored proc (there is a lot more going on in here, but this is in one leg of its logic). Why would someone ever select top 0 rows from a table? Is this some sort of SQL hack or trick I am not familiar with?
推荐答案
在 UNION ALL 中命名列
To name columns in a UNION ALL
请务必阅读 Alex K. 的回答.他有很多我也用过的理由.这只是最明显的一个.
Be sure to read Alex K.'s answer as well. He has a lot of reasons that I have used as well. This was just the most obvious one.
这篇关于SQL Server:选择前 0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文