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