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

SQLº¯Êý:ÊÂÎñʵÀý ΰÉÙÌìµØ

ÊÂÎñ¾ÍÊǸºÔð°ÑһϵÁвÙ×÷¿´×öÒ»¸ö¶ÀÁ¢µÄÂß¼­µ¥Ôª£¬ÕâЩ²Ù×÷Ҫôͬʱ³É¹¦£¬ÒªÃ´Í¬Ê±Ê§°Ü¡£ÏÂÃæÊÇÒ»¸ö¾­µäµÄÀý×Ó£º
create procedure TransferMoeny
(
    @fromAccountNo varchar(50),-- ×ª³öÕ˺Å
    @ToAccountNo varchar(50),--תÈëÕ˺Å
    @MoneyCount money--תÕ˽ð¶î
)
as
--ÅжÏÕ˺ÅÊÇ·ñ´æÔÚ
if exists (select 1 from ÕÊ»§±í where Õ˺Š= @fromAccountNo) 
begin
    if exists (select 1 from ÕÊ»§±í where Õ˺Š= @ToAccountNo) 
    begin
        --ÅжÏת³ö½ð¶îÊÇ·ñ´óÓÚµ±Ç°Óà¶î
        if (select µ±Ç°Óà¶î from ÕÊ»§±í where Õ˺Š= @fromAccountNo) >= @MoneyCount
        begin
            --¿ªÊ¼×ªÕË
            begin transaction
            insert into [´æÈ¡¼Ç¼±í] ([Õ˺Å],[´æÈ¡ÀàÐÍ], [´æÈ¡½ð¶î]) values(@fromAccountNo, -1,@MoneyCount)
            if @@error <> 0
            begin
                rollback transaction--·¢Éú´íÎóÔò»Ø¹öÊÂÎñ£¬ÎÞÌõ¼þÍ˳öl
                return
            end
                   &nbs


Ïà¹ØÎĵµ£º

Óû§saµÇ¼ʧ°Ü,¸ÃÓû§Óë¿ÉÐÅsql serverÁ¬½ÓÎÞ¹ØÁª

½ñÌì²âÊÔwebÏîĿн¨ÁËÒ»¸öÊý¾Ý¿â£¬½á¹û±¨´í,ÒÔÇ°µÇ¼ֱ½ÓÑ¡Ôñ'WindowsÉí·ÝÑéÖ¤',²¢Ã»ÓÐʲôÎÊÌâ³öÏÖ!¿ÉÇ°¶Îʱ¼ä²ÉÓÃ'SQLSERVERÉí·ÝÑéÖ¤'È¥µÇ¼,ËæÖ®µÄÎÊÌâ¾ÍÀ´ÁË.ÎÞÂÛÓÃʲô·½·¨¾ÍÊÇÒ»¸ö½á¹û³ö´í! ³ö´íµÄÔ­ÒòÊÇ:'Óû§ 'sa' µÇ¼ʧ°Ü¡£¸ÃÓû§Óë¿ÉÐÅ SQL Server Á¬½ÓÎÞ¹ØÁª'.½ñÌìÉÏÍøÉϲéÁË°ëÌ컹ÊǸ㲻¶¨,×îºó¾­¹ýÍøÉϺÍÊéÉ ......

sql ·ÖÒ³Óï¾ä

1. select  top pageSize
* from table where id not in(select top((pageNo-1)*pageSize
) id from table order by id asc)
2. select * from table where  id<=pageSize*pageNo
and id>(pageNo-1)*pageSize
order by id asc
×¢£º
pagesizeÿҳÏÔʾµÄ¼Ç¼Êý
pageNoµ±Ç°µÚ¼¸Ò³
......

SQLº¯Êý left()¡¢charindex()µÄʹÓÃ

SQLº¯Êý left()¡¢charindex()µÄʹÓÃ
1¡¢left()
LEFT (<character_expression>£¬ <integer_expression>)
·µ»Øcharacter_expression ×óÆð integer_expression ¸ö×Ö·û¡£
2.charindex()
·µ»Ø×Ö·û´®ÖÐij¸öÖ¸¶¨µÄ×Ó´®³öÏֵĿªÊ¼Î»Öá£
CHARINDEX (<’substring_expression’>£¬ <expressio ......

Ôõô°Ñpowerdesignerµ¼³öµÄsqlÓÃPHPµ¼ÈëMysQLÊý¾Ý¿â

ÎÒÃÇÖªµÀÓÃpowerdesignerµ¼³öµÄsqlÎļþºó׺Ϊ'.sql'£»ÓÃphpmyadminºÜÈÝÒ×µ¼ÈëMysQLÊý¾Ý¿â£¬µ«ÊÇÓÃPHPÔõôµ¼ÈëÊý¾Ý¿âÄØ?
ÎÒÓÃpowerdesignerÉè¼ÆÒ»¸öÊý¾Ý¿âºóµ¼³ösqlÎļþ£¨Ò»¸öͶƱϵͳ£©Îª'vote.sql'£»
ÎļþÄÚÈÝΪ£¨Ò»Ð©sqlÓï¾äºÍ×¢ÊÍ£©£º
        
/*======================= ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ