SQL Server: Select Top 0?

后端 未结 8 1650
谎友^
谎友^ 2020-12-17 07:37

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 ro

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-17 08:23

    Let me provide an additional use:

    If you want a message printed in the output rather than in messages, you could use

    select top 0 0 'Your message here'

    instead of

    print 'Your message here'

提交回复
热议问题