这样创建一个存储过程老是会报错:“'@count' 附近有语法错误。”
create proc test1 @count int
as
begin
declare @s varchar(400)
set @s='select top '+cast(@count as varchar(10))+' OrderID from orders'
exec(@s)
end
create proc test1 @count int
as
begin
declare @s varchar(400)
set @s='select top '+cast(@count as varchar(10))+' OrderID from orders'
exec(@s)
end
as
begin
declare @s varchar(400)
set @s='select top '+cast(@count as varchar(10))+' OrderID from orders'
exec(@s)
end
能够解释一下吗??拜托了。因为我实际的查询语句更复杂,是这样的:
select top 10 * from orders where OrderID not in(select top @count OrderID from orders order by OrderID)假如这样,又要怎么写呢?