---测试数据
declare @TABLE1 table (id int,msg varchar(10))
insert @TABLE1 select 1,'11'
union select 2,'fff'
union select 3,'ffffff'
union select 4,'faf'
union select 5,'aaaaa'
union select 6,'fffas'
declare @TABLE2 table (id int,
msg1 varchar(10),
msg2 varchar(10),
msg3 varchar(10),
msg4 varchar(10),
msg5 varchar(10))
----查询
insert @TABLE2 select id = (id-1)/5+1, msg1 = max(case when id%5 =1 then msg else '' end),
msg2 = max( case when id%5=2 then msg else '' end),
msg3 = max(case when id%5 = 3 then msg else '' end),
msg4 = max(case when id%5 = 4 then msg else '' end),
msg5 = max(case when id%5=0 then msg else '' end)
from @TABLE1
group by (id-1)/5+1 select * from @table2
declare @TABLE1 table (id int,msg varchar(10))
insert @TABLE1 select 1,'11'
union select 2,'fff'
union select 3,'ffffff'
union select 4,'faf'
union select 5,'aaaaa'
union select 6,'fffas'
declare @TABLE2 table (id int,
msg1 varchar(10),
msg2 varchar(10),
msg3 varchar(10),
msg4 varchar(10),
msg5 varchar(10))
----查询
insert @TABLE2 select id = (id-1)/5+1, msg1 = max(case when id%5 =1 then msg else '' end),
msg2 = max( case when id%5=2 then msg else '' end),
msg3 = max(case when id%5 = 3 then msg else '' end),
msg4 = max(case when id%5 = 4 then msg else '' end),
msg5 = max(case when id%5=0 then msg else '' end)
from @TABLE1
group by (id-1)/5+1 select * from @table2
select
max(case (ID-1)%5 when 0 then Msg end),
max(case (ID-1)%5 when 1 then Msg end),
max(case (ID-1)%5 when 2 then Msg end),
max(case (ID-1)%5 when 3 then Msg end),
max(case (ID-1)%5 when 4 then Msg end)
from
TABLE1
group by
(ID-1)/5
order by
(ID-1)/5
DECLARE @INDEX INT ,@MSG1 VARCHAR(50),@MSG2 VARCHAR(50),@MSG3 VARCHAR(50),@MSG4 VARCHAR(50),@MSG5 VARCHAR(50),@MSG VARCHAR(50)
DECLARE CUR CURSOR FOR SELECT ID,MSG FROM TABLE1
OPEN CUR
FETCH NEXT FROM CUR INTO @INDEX,@MSG
WHILE @@FETCH_STATUS=0
BEGIN
IF @INDEX%5=1
SET @MSG1=@MSG
ELSE IF @INDEX%5=2
SET @MSG2=@MSG
ELSE IF @INDEX%5=3
SET @MSG3=@MSG
ELSE IF @INDEX%5=4
SET @MSG4=@MSG
ELSE IF @INDEX%5=0
BEGIN
SET @MSG5=@MSG
INSERT INTO TABLE2(MSG1,MSG2,MSG3,MSG4,MSG5)
VALUES(@MSG1,@MSG2,@MSG3,@MSG4,@MSG5)
ENDFETCH NEXT FROM CUR INTO @INDEX,@MSG
END
CLOSE CUR
DEALLOCATE CUR
ID Msg Flag
自动增长Int Varchar(10) Int
有一个程序在不定时地往里面插入数据,插入时flag=0。
现要求写一个存储PROC_SEND过程供一个程序调用,对插入的数据及时取出,每次取最多10条,取出后删除掉。要按照插入顺序取,且不能取重复的,也不能漏取。
三:现要求用软件写一个调用题目二中所写存储过程的程序,简要写出所用工具和实现方案。
四:简要写出完成一个小型涉及数据库的程序的步骤。
2,windows使用系统自带的IP安全策略,它在服务中的名称叫做什么?
3,出现网络故障,使先软后硬还是先硬后软,请给出你自己的看法?
4,如果一个数据库服务器要提供大量的读、写操作,请给出服务器硬件最低要求和目前市场估价?
5,是否有组建200台以上计算机的局域网络的经验?有的话,请给出实施纲要?
6,清除病毒的方法:是依靠杀毒软件还是手工?如果有手工清除病毒的经验,请给出清除的大致步骤?
7,Rj45水晶头的做法,分直连线和交叉线的标准做法。
8.写常见的服务对应端口的对照表至少10个。如:FTP 21。
9,察看服务器当前正在连接ip列表命令是?
10,你觉得你离一名合格的网管,还有多大的差距?