CREATE PROCEDURE student_test_create
@courseName varchar(15),
@type varchar(10),
@num int
as
begin
select top @num *
from item
where courseName=@courseName and @type= type order by newid()
end
GO@num有语法错误???
@courseName varchar(15),
@type varchar(10),
@num int
as
begin
select top @num *
from item
where courseName=@courseName and @type= type order by newid()
end
GO@num有语法错误???
@courseName varchar(15),
@type varchar(10),
@num int
as
begin
declare @s nvarchar(2000)
set @s='select top '+rtrim(@num)+' *
from item
where courseName='''+@courseName+''' and type='''+@type+''' order by newid()'
exec(@s)
end
GO
from item
where courseName=@courseName and @type= type order by newid()'
exec
@courseName varchar(15),
@type varchar(10),
@num int
as
begin
select top (@num) *
from item
where courseName=@courseName and @type= type order by newid()
end
GO
varchar '''+@courseName+'' ''+@type+''