SQL Server: Select Top 0?

后端 未结 8 1630
谎友^
谎友^ 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:18

    I have mostly used it when creating temp tables from an existing DB table - without any data. The following is more reliable though than using top.

    SELECT * FROM  LIMIT 0;
    

提交回复
热议问题