SqlÅÅÐò - MS-SQL Server / »ù´¡Àà
ÎÒµÄTblworkbill±íµÄÊý¾ÝÈçÏÂ:
id workbillno ..................
1 1
2 6
3 a1
4 c2
5 2
6 aa
7 a2
8 5
9 7
10 d3
11 b1
. .
. .
. .
. .
ÈçºÎ½«workbillnoÅÅÐòΪ:
1
2
5
6
7
a1
a2
b1
c2
d3
aa
SQL code:
--> ²âÊÔÊý¾Ý£º[TB]
if object_id('[TB]') is not null drop table [TB]
create table [TB]([id] int,[workbillno] varchar(2))
insert [TB]
select 1,'1' union all
select 2,'6' union all
select 3,'a1' union all
select 4,'c2' union all
select 5,'2' union all
select 6,'aa' union all
select 7,'a2' union all
select 8,'5' union all
select 9,'7' union all
select 10,'d3' union all
select 11,'b1'
create function dbo.f_ASCII(@s varchar(50)) returns int
as
begin
declare @i int
set @i=0
while len(@s)>0
begin
set @i=@i+ASCII(left(@s,1))
set @s=right(@s,len(@s)-1)
end
return @i
end
go
select * from TB order by dbo.f_ASCII(workbillno)
/*
id workbillno
----------- ----------
1 1
5 2
8 5
2 6
Ïà¹ØÎÊ´ð£º
½«Ò»¸ö±í21~30ɾ³ý£¬sqlÓï¾äÔõôд
Õâ¸öÌ«ÁýͳÁË£¬ÊÇÅÅÐòºóµÄµÚ21Ìõµ½30Ìõ¼Ç¼ɾ³ý»¹ÊÇijһÁÐÖµÔÚ21µ½30Ö®¼äµÄɾ³ý°¡£¿
21-30ÊÇʲôÒâ˼£¿×ֶεϰ¾Ídelete from table1 where col1>=21 and col1<=30
Ö¸µ ......
Ö´ÐеÄ˳Ðò£º
1£©Îļþä¯ÀÀ¿ò£¨Ñ¡ÔñÎļþʹÓã©
Ñ¡ÔñºÃÎļþºó
µã»÷Ò»¸öµ¼Èë°´Å¥µÄʱºò £¬°ÑÉÏÃæÉÏ´«¿òÀïµÄcsvÎļþÒÔÒ»¸öIDΪÎļþÃû£¬ÉÏ´«µ½**/**Îļþ¼ÐÏÂ
2£©¶ÁÈ¡Õâ¸öÎļþ¼ÐϵÄcsvµÄÎļþ£¬×ª»»³Ésql
3 ......
»·¾³£º1.win2003server+oracle9i
2.oracle9i×Ö·û¼¯ÎªAMERICAN_AMERICA.WE8ISO8859P1
3.oracle sql developer°æ±¾ 1.5.5
ÏÖÏóÃèÊö: 1.ÔÚsql developer ÖвéѯoracleÖеÄij¸ö±í£¬ÖÐÎÄÈ«²¿ÏÔʾΪÂÒÂë¡£
......
ÔÚOracleÖУ¬ÎÒÏë²éϵͳʱ¼äÒ»ÌìµÄÊý¾Ý£¬Ê¹ÓÃÕâ¸öÓï¾ä
select * from tablename
where create_time>SYSDATE-1
and create_time <SYSDATE
ÎÒÏë²é×òÌì00£º00µ½½ñÌì00£º00µÄsqlÔõôд£¬
» ......
ÎÒÒ»¸öÏîÄ¿£¬Óиö²åÈë²Ù×÷£¬¾ßÌåÊÇÕâÑùµÄ£º
ÎÒÓнø»õÐÅÏ¢±í¡£ÔÚ³ö»õʱѡÔñÏàÓ¦µÄ½ø»õÐÅÏ¢£¬ÊäÈëÊýÁ¿£¬Ñ¡Ôñ²¿Ãź󣬵㱣´æ°´Å¥£¬ÓÉÓÚÍøÂçÑÓʱ£¬µãÒ»ÏÂûÓз´Ó³£¬ÓÚÊÇÓû§¾ÍÓÖµãһϣ¬µ¼ÖÂÒ»´Î²åÈëÁËÁ½Ìõ¼Ç¼:
Àý£º
......