Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate » MS SQL  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 求教数据库升序排列问题
358182552





发贴: 8
积分: 0
于 2006-05-20 20:39 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我要通过JAVA实现对学生档案按学号顺序升序排列
不知如何用什么表达式!!请高手帮帮忙了



作者 Re:求教数据库升序排列问题 [Re:358182552]
358182552





发贴: 8
积分: 0
于 2006-05-20 20:40 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
另外如何在指定记录位置后面插入一条学生记录呢?


作者 Re:求教数据库升序排列问题 [Re:358182552]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2006-05-21 21:50 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
1. 這和MS SQL有啥關係呢?
2. "指定记录位置"是啥?



作者 Re:求教数据库升序排列问题 [Re:358182552]
358182552





发贴: 8
积分: 0
于 2006-05-22 17:14 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
呵呵
我是通过ACCESS为数据库的,第一个问题现在已经解决:select * from 表 ORDER BY 字段
“指定记录位置”就是比如说在学号为10000和10002的学生之间插入一条记录信息--10001。



作者 Re:求教数据库升序排列问题 [Re:358182552]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2006-05-23 03:59 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Is 学号 AutoNumber??
you may try
insert into 表 (学号, 字段1, 字段2, ... 字段N) values (10002, value1, value2, ... valueN)

Anyway, I don't really know what your problem is.



作者 Re:求教数据库升序排列问题 [Re:358182552]
358182552





发贴: 8
积分: 0
于 2006-05-23 16:32 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
谢谢你能有空看我的问题
此表并不是autonumber!
我的意思是在指定的位置上插入!例:一表的学生记录学号顺序为
00001
00002
00003
00004
……
现在要在0001与0002之间插入00005:
00001
00005
00002
00003
00004
……
就是这个样子,Do you understand??
呵呵!!!!Cool



作者 Re:求教数据库升序排列问题 [Re:358182552]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2006-05-23 20:41 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Well, I don't understand.
I don't think you could control the sequence without defining a sorting key.



作者 Re:求教数据库升序排列问题 [Re:why]
ditty

负资产小资

CJSDN高级会员


发贴: 1038
积分: 143
于 2006-05-24 09:07 user profilesend a private message to usersend email to dittysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
hehe,如果想在00001和00002之间插入00005没有问题,前提是,你不能再用这个字段进行排序。需要增架其他字段,专门用于排序。

select * from xxx order by 序号;
原始效果:
序号 字段1 字段2 ....
00001 00001 aaaaa....
00002 00002 bbbb....
....

插入时
insert into xxx (序号,字段1,字段2...) values(‘0000101’,'00005','cccc...');

select * from xxx order by 序号;

插入后效果:
序号 字段1 字段2 ....
00001 00001 aaaaa....
0000101 00005 cccc....
00002 00002 bbbb....
....



内忧外患的时代,洗心革面,阿咪豆腐~
作者 Re:求教数据库升序排列问题 [Re:358182552]
358182552





发贴: 8
积分: 0
于 2006-05-24 13:36 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
恩,好的!
可是我还是不太明白为什么不可以强制性的在指定的位置插入.这是我们教材上的一道题,我问老师,唉!那个菜呀^*^!咪咪忽忽给我讲了一会儿,然后来个"这个我也不是十分太清楚,自己下去想吧!"你们不知道我当时是啥表情……
AngryAngryDevil
唉!不过楼上的大哥的主意不错,我试试了,谢谢!!




flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923