Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

[ת]Éú³ÉÎÞ¼¶Ê÷(sqlº¯Êý)

--´¦ÀíʾÀý
--ʾÀýÊý¾Ý
create table tb(ID int,Name varchar(10),ParentID int)
insert tb select 1,'AAAA'    ,0
union all select 2,'BBBB'    ,0
union all select 3,'CCCC'    ,0
union all select 4,'AAAA-1'  ,1
union all select 5,'AAAA-2'  ,1
union all select 6,'BBBB-1'  ,2
union all select 7,'CCCC-1'  ,3
union all select 8,'CCCC-2'  ,3
union all select 9,'AAAA-1-1',4
go
--´´½¨´¦ÀíµÄº¯Êý
create function f_id()
returns @re table(id int,level int,sid varchar(8000))
as
begin
    declare @l int
    set @l=0
    insert @re select id,@l,right(10000+id,4)
    from tb where ParentID=0
    while @@rowcount>0
    begin
        set @l=@l+1
        insert @re select a.id,@l,b.sid+','+right(10000+a.id,4)
        from tb a,@re b
        where a.ParentID=b.id and b.level=@l-1
    end
    return
end
go
--µ÷Óú¯ÊýʵÏÖ²éѯ
select a.*,´øËõ½øµÄName=space(b.level*4)+a.Name
from tb a,f_id() b
where a.id=b.id
order by b.sid
go
--ɾ³ý²âÊÔ
drop table tb
drop function f_
[ת]http://www.cnblogs.com/catxp/articles/381747.html


Ïà¹ØÎĵµ£º

rs.open sql,conn Óëconn.execute(sql)µÄÇø±ð

rs.open sql,conn Óëconn.execute(sql)µÄÇø±ð ÊÕ²Ø
ÒýÓÓsrnld£¨ÌìÑÄ£©”µÄ»°£º 
ʲôʱºòÓÃʲô?  
  ÄÇ¾ÍÆ¾¸öÈ˾­Ñé»ýÀ۵ĸоõÁË:  
    Èç¹ûÖ»ÐèÒªÒ»±Ê´ø¹ýµÄÅöÅöÊý¾Ý¿â,ÓÃexecute  
  Èç¹ûÒª¶ÔÊý¾Ý¿â×÷±È½ÏÅÓÔӵIJÙ×÷!Ôò×îºÃÓà ......

ÈçºÎ´ÓEXPDPµ¼³öµÄÎļþÀï»ñµÃÓû§ÊÚȨµÄSQLÓï¾ä


ÈçºÎ´ÓEXPDPµ¼³öµÄÎļþÀï»ñµÃÓû§ÊÚȨµÄSQLÓï¾ä 
 
´òËãÇ¨ÒÆÒ»ÏµÍ³£¬ÓÉÓÚÊÇ¿çÆ½Ì¨µÄÇ¨ÒÆ£¬RMANÊDz»ÄÜÓÃÁË£¬¿¼ÂÇʹÓÃEXPDP/IMPDPÀ´½øÐе¼Èëµ¼³ö£¬µ¼Èë¹ý³Ì·¢ÏÖN¶àÓû§µÄȨÏÞ¸ã³öÁË£¬Âé·³ÖØµ¼ÊÇ¿ÉÒÔ»¨Ê±¼äÌ«³¤£¬Ñо¿ÁËһϣ¬Éú³ÉÁËÈ«²¿µÄSQLµÄ½Å±¾¡£
impdp system/manager schemas=user DIRECTORY=DUMP_FILES ......

[SQL Server 2005] hashÁª½ÓËã·¨

SQL Server 2005 hashÁª½ÓËã·¨
Èç¹ûÁ½¸öÁª½ÓÊäÈë¶¼ºÜ´ó£¬¶øÇÒÕâÁ½¸öÊäÈëµÄ´óС²î²»¶à£¬ÔòÔ¤ÏÈÅÅÐòµÄºÏ²¢Áª½ÓÌṩµÄÐÔÄÜÓë¹þÏ£Áª½ÓÏà½ü¡£µ«ÊÇ£¬Èç¹ûÕâÁ½¸öÊäÈëµÄ´óСÏà²îºÜ´ó£¬Ôò¹þÏ£Áª½Ó²Ù×÷ͨ³£¿ìµÃ¶à¡£
   ¹þÏ£Áª½Ó¿ÉÒÔÓÐЧ´¦ÀíδÅÅÐòµÄ´óÐÍ·ÇË÷ÒýÊäÈë¡£ËüÃǶԸ´ÔÓ²éѯµÄÖмä½á¹ûºÜÓÐÓã¬ÒòΪ£º
 &nbs ......

PL/SQL³ÌÐòÉè¼Æ£¨ÓαêµÄʹÓÃ)

ΪÁË´¦Àí SQL Óï¾ä£¬ORACLE ±ØÐë·ÖÅäһƬ½ÐÉÏÏÂÎÄ( context area )µÄÇøÓòÀ´´¦ÀíËù±ØÐèµÄÐÅÏ¢£¬ÆäÖаüÀ¨Òª´¦ÀíµÄÐеÄÊýÄ¿£¬Ò»¸öÖ¸ÏòÓï¾ä±»·ÖÎöÒÔºóµÄ±íʾÐÎʽµÄÖ¸ÕëÒÔ¼°²éѯµÄ»î¶¯¼¯(active set)¡£
 ÓαêÊÇÒ»¸öÖ¸ÏòÉÏÏÂÎĵľä±ú( handle)»òÖ¸Õ롣ͨ¹ýÓα꣬PL/SQL¿ÉÒÔ¿ØÖÆÉÏÏÂÎÄÇøºÍ´¦ÀíÓï¾äʱÉÏÏÂÎÄÇø»á·¢ÉúЩʲôÊÂÇ ......

Interbase/FirebirdµÄSQLÓï·¨(ÊÕ²Ø)

×î½üÔÚȺÀï´ó¼ÒͻȻÌÖÂÛÏÂfb(firebird)À´ÁË£¬ºÇ£¬¿´ÁËһЩ×ÊÁÏ£¬Í»È»·¢¾õÕâ¸ö¶«Î÷Ò²ÂùºÃÍæµÄ£¬ÓÚÊÇ¿ªÊ¼´óÁ¿µÄ²éÕÒÓйصÄ×ÊÁÏ£¬ÏÂÃæÊÇÒ»
ЩfbϵÄsqlд·¨£¬×ª×ÔÍøÉÏ£¬¸÷λÅóÓѽ«¾ÍЩ¿´¿´°É£¬¹ý¼¸ÌìżÕûÀíºÃ.netÏÂʹÓÃfbµÄdemoÉÏÀ´¸ø´ó¼Ò¿´¿´°É£¬µ½Ê±Ö§³ÖÖ§³Ö°É£¬ºÇºÇ
Ò»¡¢·Öҳд·¨Ð¡Àý£º
  SELECT FIRST
10 templa ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ