日期:2014-05-17 浏览次数:20432 次
CREATE proc Random
as
CREATE TABLE #a
(
ID [int] NOT NULL,
Name [varchar](50) NOT NULL,
)
insert into #a select * from table order by newid() asc
select * from #a t where
exists
(
select 1 from
(
select top 1 * from #a where Name =t.Name
) as t2 where ID=t.ID
)
drop table #a
GO
CREATE proc [dbo].[Random]
@CN varchar(50),
@QT varchar(50)
as
CREATE TABLE #a
(
[ID] [int] NOT NULL,
[CourseName] [varchar](50) NOT NULL,
[KeyPointID] [varchar](50) NOT NULL,
[QusetionType] [varchar](50) NOT NULL,
[Content] [varchar](1000) NOT NULL,
[OptionA] [varchar](100) NOT NULL,
[OptionB] [varchar](100) NOT NULL,
[OptionC] [varchar](100) NOT NULL,
[OptionD] [varchar](100) NOT NULL,
[OptionE] [varchar](100) NOT NULL,
[OptionF] [varchar](100) NOT NULL,
)
insert into #a select * from [dbo].[TB_KeyPoint] where [CourseName]=@CN and [QusetionType]=@QT order by newid() asc
select * from #a t where
exists
(
select 1 from
(
select top 1 * from #a where [KeyPointID]=t.KeyPointID