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

SQLÓï¾äÎÊÌâ

create trigger TR_Delete_pm_WorkCard
on pm_WorkCard
for delete
as
if @@rowcount=0 return
begin tran
  update pm_PlanEntry
  set FDispatchQty=t4.FDispatchQty - t1.FDispatchQty
  from deleted as t2 join pm_WorkCardEntry as t1 on(t1.fparentid=t2.FInterID)
      join pm_Plan t3 on(t2.FPlanID=t3.FInterID)
      join pm_PlanEntry as t4 on(t3.FInterID=t4.fparentid and t1.FRowID=t4.FRowID)
if @@error=0
  commit tran
else
  rollback tran

±íÖÐ×Ö¶ÎûÓÐÎÊÌ⣬´¥·¢Æ÷Äܹ»Ö´Ðгɹ¦£¬¾ÍÊǵò»µ½Ô¤ÆÚµÄЧ¹û¡£
ÄãÏȰÑÀïÃæµÄ²éѯÓï¾äÈ¥Ö´ÐÐһϿ´¿´Ð§¹û

ÒýÓÃ
ÄãÏȰÑÀïÃæµÄ²éѯÓï¾äÈ¥Ö´ÐÐһϿ´¿´Ð§¹û


ͨ¹ýÕâ¸öÓï¾ä
select *
from pm_WorkCard as t2 join pm_WorkCardEntry as t1 on(t1.fparentid=t2.FInterID)
      join pm_Plan t3 on(t2.FPlanID=t3.FInterID)
      join pm_PlanEntry as t4 on(t3.FInterID=t4.fparentid and t1.FRowID=t4.FRowID)

Äܵõ½Êý¾Ý¡£

if @@rowcount=0 return --ÎÊÌâÊDz»ÊÇÔÚÕâÀÓÐÓÃÂð£¿

ÒýÓÃ
if @@rowcount=0 return --ÎÊÌâÊDz»ÊÇÔÚÕâÀÓÐÓÃÂð£¿

¾õµÃÊÇûʲôÓÃ,ºÇºÇ,±¾À´¾ÍÊǺ󴥷¢ÁË

ÒýÓÃ
if @@rowcount=0 return --ÎÊÌâÊDz»ÊÇÔÚÕâÀÓÐÓÃÂð£¿


Ïà¹ØÎÊ´ð£º

linux ϵÄjava ³ÌÐòµ÷ÓÃsqlplusÖ´ÐÐ.sqlÎļþÂÒÂë

                        ÏÖÔÚÎÒµÄÇé¿öÊÇÕâÑù£º

                        ÎÒµÄ ......

javaÁ¬½Ósql 2005ÎÊÌâ ÔÚÏߵȡ£¡£¡£¡£


import java.sql.*;

public class Test {
public static void main(String[] srg) {
  String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";  //¼ÓÔØJDBC ......

sqlÊý¾Ý¸²¸Ç£¡

ÔõôʹÎÒÿ´Î²»ÊǸüÐÂÊý¾Ý¿â
¶øÊǸ²¸ÇÉϴεÄËùÓмÇÂ¼ÄØ£¡
ÒòΪÓÐʱºòʱ¼äÌõ¼þ²»Í¬
SQL code:

select * from hwouttb where
CAST(REPLACE(REPLACE(REPLACE(outdate,'Äê','-' ),'ÔÂ','-'),'ÈÕ','') AS ......

Çë½ÌÒ»¸öSQLÓ¦ÓÃÎÊÌâ

ÓÐʱºòÔÚÊý¾ÝÖвéѯÊý¾ÝµÄʱºò¿¼ÂÇÐÔÄÜÎÊÌ⣬»á½«¸´ÔÓÓï¾ä²ð·Ö»ò½èÓÃÁÙʱ±íÀ´¶à´Î²éѯ×îÖյõ½ÏëÒªµÄÊý¾Ý£¬ÏÖÔÚ½«ÕâЩ²éѯÄÚÈÝ×ö³É±¨±í£¬ÐèҪд¸öÓï¾äÒ»ÆøºÇ³É¡£
ÎÒÏëÎʵÄSQLÊÇ·ñ¿ÉÒÔÔÚ²éѯÓï¾äÒ»½áÊøºó£¬ÔÙ×Ô¶¯Ô ......

sql inÎÊÌâ

listidÊÇintÊý¾Ý
declare @listid nvarchar(100)
set @listid='(1,2,3,7,9,10)'
select * from forums where listid in(@listid)ʱÌáʾÈçÏ´íÎó£º
ÔÚ½« nvarchar Öµ '(1,2,3,7,9,10)' × ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ