当前位置: 代码迷 >> Sql Server >> 就10分了,跪求存储过程,该如何处理
  详细解决方案

就10分了,跪求存储过程,该如何处理

热度:66   发布时间:2016-04-27 20:19:44.0
就10分了,跪求存储过程
create   proc   ansList
@NC   nvarchar(12),
@nbz   int,
@topnum   int
as
exec   ( 'select   top   '[email protected]+ '   a1,a2,a3,a4   from   An   where   NC   =   @NC   and   [email protected]   order   by   ndate   desc ')
go

这个存储过程为什么运行不了

------解决方案--------------------
create proc ansList
@NC nvarchar(12),
@nbz int,
@topnum int
as
Begin
[email protected] Varchar(1000)
Select @S = 'select top '+ Cast(@topnum As Varchar) + ' a1,a2,a3,a4 from An where NC = ' ' ' + @NC + ' ' ' and newsbz= ' + Cast(@nbz As Varchar) + ' order by ndate desc '
exec(@S)
End
go
  相关解决方案