create proc SelectRcd
@count int
as
select top @count * from TableA
go
提示@count附近出错
如果 select 10 * from TableA是没有问题的
ps:我想使用存储过程来实现其他的功能,sql语句不是很方便
希望大牛s指点指点!感激ing~~~
create proc SelectRcd
@count int
as
exec(select top + @count + * from pubs..authors)
go
exec SelectRcd 10
create proc SelectRcd
@count int
as
exec(select top +@count+ * from TableA)
go
create proc SelectRcd
@count int
as
exec(select top +@count+ * from TableA)
go
exec SelectRcd
同意上楼,楼上的!
create proc SelectRcd
@count int
as
declare @s varchar(1000)
@s=select top + cast(@count as varchar(10)) + * from pubs..authors
exec(@s)
go