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

sql update Ó÷¨

½«b±íÖÐcallerÁеÄÖµ²åÈëa±íÖÐcallÁÐÖС£
 create table a
(
 fid int,
 call varchar(20),
 age int
)
create table b
(
 fid int,
 caller varchar(20),
 parentId int
)
select * from a
select * from b
insert into a values(1,null,19)
insert into a values(2,null,20)
insert into b values(1,'a',1)
insert into b values(2,'b',2)
update  a set call =b.caller from b inner join a on a.fid = b.parentId


Ïà¹ØÎĵµ£º

ÐÞ¸ÄSQLÊý¾Ý¿âµÄÃû³Æ


ÆäʵÔÚÐÞ¸ÄÊý¾Ý¿âÃû³Æ֮ǰ£¬Èç¹ûÓÐÓû§Á¬½Óµ½Êý¾Ý¿âµÄ»°»áÔì³ÉÊý¾Ý¿âÖØÃüÃûʧ°Ü£¬¿ÉÒÔÏÈÖ´ÐÐ
select spid
from master.dbo.sysprocesses
where dbid=db_id('OldDbName')
½á¹û¼¯ÖÐÏÔʾµÄÊǵ±Ç°Á¬½Óµ½Êý¾Ý¿âOldDbNameµÄÁ¬½Ó
±ÈÈç½á¹ûÊÇ
79
81
µ±È»£¬Êµ¼ÊÖµÓ¦¸Ã²»ÊÇÕâÁ½¸ö
È»ºóÖ´ÐÐ
kill 79
kill 81
¹Ø±ÕÒѽ¨Á¢ ......

SQLÓÅ»¯¹ý³ÌÖг£¼ûOracle HINTµÄÓ÷¨

 ÔÚSQLÓï¾äÓÅ»¯¹ý³ÌÖУ¬ÎÒÃǾ­³£»áÓõ½hint,ÏÖ×ܽáÒ»ÏÂÔÚSQLÓÅ»¯¹ý³ÌÖг£¼ûOracle HINTµÄÓ÷¨£º
1. /*+ALL_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ¡Ôñ»ùÓÚ¿ªÏúµÄÓÅ»¯·½·¨,²¢»ñµÃ×î¼ÑÍÌÍÂÁ¿,ʹ×ÊÔ´ÏûºÄ×îС»¯.
ÀýÈç:
SELECT /*+ALL+_ROWS*/ EMP_NO,EMP_NAM,DAT_IN from BSEMPMS WHERE EMP_NO='SCOTT';
2. /*+FIRST_ROWS*/
±í ......

SQL¶Ô³ÌÐòÐÔÄܵÄÓ°Ïì


¡¾ÏÈ˼¿¼Ò»¸öÎÊÌ⣺Áû×ÓºÍϹ×ÓÔÚÒ»Æð»áÓÐʲô½á¹û£¿¡¿
×òÌìд³ÌÐò£¬ÓиöСģ¿éÊÇͨ¹ý·ÖÎöÊýÊ®ÍòÌõ¼Ç¼£¬ÓëÒì¹¹µÄÊý¾Ý±í½øÐбȶԣ¬ÕÒ³ö·ûºÏÌõ¼þµÄÐÅÏ¢¡£
ÔÚµÚÒ»Ìõ²éѯÖУ¬ÐèÒª²éѯËùÓмǼµÄÒ»¸ö×ֶΣ¬²¢ÌáÈ¡¸Ã×Ö¶ÎÖеĵÚ5ÖÁµÚ10¸ö×Ö·û´®£¬ÒªÓëÒì¹¹Êý¾Ý±í±È½ÏµÄ¾ÍÊÇÕâ¸ö×Ö´®¡£ÔÚ×î³õµÄ°æ±¾ÖУ¬¶ÔÓÚÐÔÄܲ¢Ã»ÓÐ×ö¸ü¶àµÄ¿¼Â ......

ORACLE PL/SQL ´æ´¢¹ý³Ì½Ì³Ì


(1)SEQNAME.NEXTVALÀïÃæµÄÖµÈçºÎ¶Á³öÀ´£¿¿ÉÒÔÖ±½ÓÔÚinsert into test values(SEQNAME.NEXTVAL) ÊÇ¿ÉÒÔÓà  ÕâÑù£º     
SELECT tmp#_seq.NEXTVAL
        INTO id_temp
        from DUAL;  È»ºó¿ÉÒ ......

Ò»ÌõSQLɾ³ýËùÓбíÖÐÊý¾Ý

         ÓÉÓÚ´¦ÓÚϵͳ¿ª·¢µÄºóÆÚ£¬ÐèÒª¸ø¿Í»§ÑÝʾ¡£·¢ÏÖ´óÁ¿µÄ±í£¬´æÔÚ´óÁ¿µÄ²âÊÔÊý¾Ý¡£ÐèÒªÇå³ý£¬ÓÓdelete from tablename” -->  ÔÎËÀ¡£ºóÀ´·¢ÏÖ¾ÓÈ»ÓÐÕâôǿ´óµÄ¶«¶«¡£ £º£©
 EXECUTE sp_msforeachtable 'delete from ?' ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ