加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

几种考试排场和编号方法

(2013-09-03 08:41:56)
标签:

考场编排

分类: 考生号考场号座位号

1、随机无规律插花排序法

&& b1为原表,给b1增加一新列 Sjh,生成新表b2

Select Rand() As Sjh,* From B1 Into Table B2

&& Sjh 排序,生成新表b3

Select * From B1 Order By Sjh Into Table B3

&& b3增加一新列 Xh,生成新表b4 (结果表)

Select Recn() As Xh,* From B2 Order By Xh Into Table B4

Drop Table B2  &&删除表b1

Drop Table B3  &&删除表b2

2、指定规律插花排序法

** 根据人数多少搭配相等的五组数据,生成五个临时表

Sele * From Bmk Where Bmxh In([01]) Into Cursor B1

Sele * From Bmk Where Bmxh In([03],[04]) Into Cursor B2

Sele * From Bmk Where Bmxh In([02]) Into Cursor B3

Sele * From Bmk Where Bmxh In([06]) Into Cursor B4

Sele * From Bmk Where Bmxh In([07],[05]) Into Cursor B5

** 把五个临时表合并,按第一列‘Xh’排序,即生成五组插花排序的数据

Sele Recn() Xh,* From B1;

Union Sele Recn() Xh,* From B2;

Union Sele Recn() Xh,* From B3;

Union Sele Recn() Xh,* From B4;

Union Sele Recn() Xh,* From B5 Order By 1 Into Table B6

3、准考证号的生成方法

(1)、在表中有记录的情况下使用函数recn(),生成数值型准考证号命令如下:

        Select 2007020000+Recn() As 编号,* From 报名表

 或增加一列编号用: Update报名表 Set 编号=2007020000+Recn()

 

(2)、利用函数生成字符型序列(0000---9999)                        

  Select Right(Str(90000+Recn()),4) As Bmxh;

  From 报名表 Into Table 报名表2

 

(3)、生成开头为'0'的字符型准考证号(07140001-07149999)

    Select '0714'+Right(Str(90000+Recn()),4) As Bmxh;

 From 报名表 Into Table报名表3

 

(4)、字符型准考证号也可以用以下方法(在考场_kc、座号_zh生成后使用)

  准考证号=[0714]+Alltrim(Kc)+Alltrim(Zh)

4、考场号与座号的生成方法

(1)、数值型考场号、座号(1 2 3 ...10 11 12)

  Select Ceiling(Recn()/30) 考场号,;

  Recn()-(Ceiling(Recn()/30)-1)*30 座号,* From 报名库

 

(2)、字符型考场号、座号(01 02 03 ...10 11)

 Select Right(Str(9000+Ceiling(Recno()/30)),3) 考场号,;

  Right(Alltrim(Str(900+Recn()- (Ceiling(Recn()/30)-1)*30)),2) 座号,* From 报名库

【注意】这样添加考场与座号列,必须用插花排序法排好顺序。

5、利用随机函数编排考场的程序

**========================================================================

** 程序名称:利用随机函数排考场程序

** 程序设计:侯进录

** 编程时间:20061225

**=========================================================================

** 生成随机号列

Select Round(Rand(),9) Sjh,* From Bmk Into Cursor B1

** 按随机号排序

Select * From B1 Order By Sjh Desc Into Cursor B2

** 生成字符型准考证号

Select[07]+Alltrim(Str(140000+Recn())) As 准考证号,; 

 **   生成字符考场号  (这里是每场30人,必要时改为4050都可以)

Right(Alltrim(Str(9000+Ceiling(Recn()/30))),3) As 考场号,;       **  生成字符型座号

Right(Alltrim(Str(900+Recn();

-(Ceiling(Recn()/30)-1)*30)),2) As  座号,* From B2 ;

Into Table 考场编排表                                                       

6、利用指定分组编排考场的程序

**=======================================================================

** 程序名称:排序

** 程序功能:多组插花

** 编程人员:侯进录

**======================================================================

** 根据人数多少搭配相等的五组数据,生成五个临时表

Sele * From Bmk Where Bmxh In([01]) Into Cursor B1

Sele * From Bmk Where Bmxh In([03],[04]) Into Cursor B2

Sele * From Bmk Where Bmxh In([02]) Into Cursor B3

Sele * From Bmk Where Bmxh In([06]) Into Cursor B4

Sele * From Bmk Where Bmxh In([07],[05]) Into Cursor B5

** 把五个临时表合并,按第一列‘Xh’排序,即生成五组插花排序的数据

Sele Recn() Xh,* From B1;

Union Sele Recn() Xh,* From B2;

Union Sele Recn() Xh,* From B3;

Union Sele Recn() Xh,* From B4;

Union Sele Recn() Xh,* From B5 Order By 1 Into Table B6

 ** 编排准考证号

Select[07]+Alltrim(Str(140000+Recn())) As 准考证号,;                 

**  编排考场号 (这里是每场30人,必要时改为4050都可以)

Right(Alltrim(Str(9000+Ceiling(Recn()/30))),3) As 考场号,;                    **  编排座号号

Right(Alltrim(Str(900+Recn();

-(Ceiling(Recn()/30)-1)*30)),2)  座号,* From As B2;

    Into Table 考场编排表   &&存成结果表

 

 

 

 

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有