the important thing is not to stop questioning

导航

 

1、拼接查询语句(SQL2000,2005,2008均可)

  DECLARE @a AS INT

  SET @a=1

  EXEC('SELECT TOP '+@a+' * FROM mtrcLanguages')

  2、直接使用(适用SQL2005以上)

  DECLARE @a AS INT

  SET @a=2

  SELECT TOP(@a) * FROM Common.tblCode tc

posted on 2015-10-27 16:40  qook  阅读(206)  评论(0编辑  收藏  举报