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

SQLÓï¾ä

±ítrans(transID,lastDate)
±íTransdetail(transID,voidDate)

ÎÒÒªµÄЧ¹ûÊÇ,µ±lastDate=voidDateʱ,UPDATE±íTransDetailÖеÄTransID¸úTransÖеÄtransIDÒ»Ñù
update Transdetail as a
set TransID=(select transID from Trans where lastDate=a.voidDate)


update TransDetail t set t.transID=(select s.transID from trans s where s.lastDate=t.voidDate)
where t.transID in (select s.transID from trans s where s.lastDate=t.voidDate)

ÐÞ¸ÄÒ»ÏÂ
update Transdetail as a
set TransID=(select transID from Trans where lastDate=a.voidDate)
where voidDate in (select lastDate from Trans)

¶¼ÄÇô¿ì,ˢоͱäÁË

Âß¼­ÓÐÎÊÌ⣬ÈçÓÐͬÑùµÄlastDate£¬ µ«²»Í¬µÄtranid£¿

    strSql1 = "select distinct transID,lastDate from trans"
    Set rst1 = Cn.OpenResultset(strSql1, rdOpenStatic)
    If Not rst1.EOF Then
        strSql2 = "select distinct voidDate from Transdetail"
        Set rst2 = Cn.OpenResultset(strSql2, rdOpenStatic)
        If Not rst2.EOF Then
            For i = 0 To rst.RowCount - 1
                If rst1!lastDate = rst2!voidDate Then
                    strSql3 = "UPDATE TransDetail SET transID= '" &am


Ïà¹ØÎÊ´ð£º

ÈçºÎÓÃc#£¬sql2000 ¿ª·¢c/sÏµĹ¤×÷Á÷£¿

±¾ÈËc#ÐÂÊÖ ¿ÉÊÇÒªÇóÒªÓÃc# £¬sql2000¿ª·¢c/sµÄ¹¤×÷Á÷£¬Ò»Í·ÎíË®£¬Çë´ó¼Ò°ïæ°ï棬¸øµã˼·£¬ËµµÄÔ¼¾ßÌåÔ½ºÃ£¬ÎÒÒ²ºÃÍùÄǸö·½ÃæÈ¥Ñ§Ï°
http://www.hxzi.com/view/61402.html
B/S°æµÄ£¬»ù±¾Ë¼ÏëÓ¦¸Ã²î²»¶àµÄ¡£¡£ ......

sqlÓï¾äÖÐÄܲ»ÄÜÕâÑùÅÅÐò£¿

Êý¾Ý±í¡¾biao¡¿£¬
×ֶΣºid¡¢myname¡¢mytxt
mytxtÄÚÈݸñʽÐÎÈ磺n|abcd¡££¨ÀýÈ磺1|ÁõµÂ»ª£¬2|Èδﻪ£¬3|αÌϼ£¬4|Âõ¿Ë@½Ü¿ËÑ·£©

ÎÒÏÖÔÚÏ£Íû¶Á¼Ç¼³öÀ´ºó£¬°´ÕÕ[mytxt]×Ö¶ÎÀïµÄÊúÏߣ¨|£©Ç°ÃæµÄÄǸöÊý× ......

SQL×ֶΣ¬ºáÏòÕ¹¿ª

ÇëÎʸ÷룬ÈçºÎ½«SQlÖУ¬Ä³×Ö¶ÎÖеÄÖµºáÏòÕ¹¿ªÄØ£¬
CASE WHEN

¾ßÌåÎÊÌâ¾ßÌå·ÖÎö£¬¿´ÄãÒªÔõôչ¿ª

ÐÕÃû  ¿ÆÄ¿      ³É¼¨
ÕÅÈý  Ó¢Óï    90
ÀîËÄ  Ó¢Óï&nb ......

sql¿ÉÒÔÓÐÁ½¸öÒÔÉϵĴ¥·¢Æ÷Â𣿣¿

sql¿ÉÒÔÓÐÁ½¸öÒÔÉϵĴ¥·¢Æ÷Â𣿣¿ÎÒÖ¸µÄÊÇfor´¥·¢Æ÷£¬ÄÇÆäËûµÄÄØ£¿£¿
ʲôÒâ˼£¿

¿ÉÒÔµÄ

10¸ö¶¼Ã»ÎÊÌâ

¿ÉÊÇÎÒдÁËÁ½¸öfor insert ´¥·¢Æ÷£¬Ôì³É½ø³Ì×èÈûÁËÄØ£¿Ôõô°ìÄØ£¿Çë¸ßÈËÖ¸µã
......

C# Á¬½ÓSQLÊý¾Ý¿â³£ÓõÄÁ¬½Ó×Ö·û´®¸ÃÈçºÎд£¿

£¨1£©string ConnString = "server=localhost;integrated security=sspi;database=pubs;";   
£¨2£©string strConnection="user uid=sa;pwd=123456;Database=test;Server=test;Connect ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ