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
Ïà¹ØÎÊ´ð£º
sql¿ÉÒÔÓÐÁ½¸öÒÔÉϵĴ¥·¢Æ÷Â𣿣¿ÎÒÖ¸µÄÊÇfor´¥·¢Æ÷£¬ÄÇÆäËûµÄÄØ£¿£¿
ʲôÒâ˼£¿
¿ÉÒÔµÄ
10¸ö¶¼Ã»ÎÊÌâ
¿ÉÊÇÎÒдÁËÁ½¸öfor insert ´¥·¢Æ÷£¬Ôì³É½ø³Ì×èÈûÁËÄØ£¿Ôõô°ìÄØ£¿Çë¸ßÈËÖ¸µã
......
access ÖÐÖ´ÐÐsql updateÓï¾äʱÓÐʱºò³É¹¦ÓÐʱºò²»³É¹¦£¬µ«ÊÇaccessÖв»³ö´íÎóÐÅÏ¢£¬²»ÖªµÀÊÇʲôÔÒò£¬ÓÐÄÄλ´óÏÀÖªµÀ£¬Çë°ïæ°¡
ÌùSQLÓï¾ä£¬¼ì²é±í¡¢×ֶεÄÓÐЧÐÔÉèÖÃ
sql ÔÚ²éѯ·ÖÎöÆ÷ÀïÃæ Ö´ÐкÜÕý³£
ÊÇ ......
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
ÏÖÔÚÓÐÒ»ORACLEÖеÄSQLÓï¾ä£¬ÐèÒªÒÆÖ²µ½DB2ÖУ¬ÇëÎʸÃSQL¸ÄÈçºÎд
ORACLEÖУº
select floor(months_between(date1,date2)) from A
date1,date2·Ö±ðΪ±íÖеÄÁ½¸ö×ֶΠ£¬¶¼ÎªÈÕÆÚÐÍ
DB2ÖÐÈçºÎʹÓÃÐ ......