Sql server´æ´¢¹ý³ÌÖÐ Êý¾Ý¼¯µÄ»º´æ
create procedure DeleteWareHouse_StoreArea_SummaryByPUR
(@po_no nvarchar(100))
as
begin
declare @cacheTable table(wh_id int);--ÉùÃ÷Ò»¸ötableÀàÐ͵ıäÁ¿
insert @cacheTable select wh_id from aps_inventory_store_area where description=@po_no--Ïò±äÁ¿@cacheTableÖÐÌí¼Ó½á¹û¼¯
--select * from @cacheTable
delete aps_inventory_summary where wh_id in(select * from @cacheTable)
delete aps_inventory_store_area where wh_id in(select * from @cacheTable)
delete aps_inventory_warehouse where wh_id in(select * from @cacheTable)
end
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
ÔÚVSÖÐдSQLÓï¾äµÄʱºò£¬Ç§ÍòÍòǧҪСÐÄÔÙСÐÄ£¬±ÈÈç ˵ Êý¾ÝÀàÐ͵ÄÆ¥Å䣬 µ¥ÒýºÅ£¨Õâ¸öÄÜ°ÑÈËÃÔËÀ£©
where ×Ó¾äÖпÉǧÍò²»ÄÜÓпոñ£¨µ±²éѯÌõ¼þΪ×Ö·û´®µÄʱºòÄÜ°ÑÄãŪ·è£¬ÎÒŪÕâ¸öµÄʱºò¶¼·èÁ˼¸´ÎÁË£¬Ê²Ã´¶¼¶Ô¾ÍÊDz鲻³öÀ´£¬µ÷ÊÔÁËN±é²Å·¢ÏÖ¡££©²»ÐÐÁË£¬³Ô·¹È¥£¬ÔÙ²»³Ô¿´¼û»îÈ˶¼ÏëÒ§ÁË¡£ ......
£¨1£©Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò£¨Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ£©
oracleµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒÖÁ×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±í£©½«×îÏȱ»´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£Èç¹ûÓÐ3¸öÒÔÉϵıíÁ¬½Ó²éѯ, ÄǾÍÐèҪѡÔñ½»²æ±í(intersection table)×÷Ϊ»ù´ ......
Èç¹ûÔÀ´µÄÊý¾Ý¿â¿ÉÓ㬷ÖÀëÊý¾Ý¿âºó£¬Ö»¸½¼ÓÊý¾ÝÎļþ£¬²»¸½¼ÓÈÕÖ¾
Èç¹û²»¿ÉÓã¬Ö»ÄÜÂýÂýµÈ»¹Ô²Ù×÷Íê³ÉÁË
ÈÕÖ¾ÎļþÌ«´óÁË£¬Ó¦¸Ã¶¨ÆÚÕûÀíÈÕÖ¾
--ѹËõÈÕÖ¾¼°Êý¾Ý¿âÎļþ´óС
&n ......
SQL> select * from t1;
ID AGE
---------- ----------
1 20
2&nbs ......