ホームページ  >  記事  >  データベース  >  SqlServer中使用参数传递前N条条件

SqlServer中使用参数传递前N条条件

WBOY
WBOYオリジナル
2016-06-07 14:54:411411ブラウズ

declare @topN int ; select @topN=10; select top (@topN) * from TableName 一定要用() 否则无效 SQL 参数 declare @topN int; select @topN = 10; select top (@topN) * from TableName

  1. declare @topN int;   
  2. select @topN = 10;   
  3.   
  4. select top (@topN) * from TableName  

    一定要用() 否则无效

SQL 参数
declare @topN int;   
select @topN = 10;   
  
select top (@topN) * from TableName  
声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。