sqlserver ´¥·¢Æ÷ÎÊÌâ
ÎÒÏë×öÒ»¸ö´¥·¢Æ÷£¬µ«Ð޸ıíTµÄ×Ö¶ÎC1ʱ£¬ÅжÏÈç¹ûÐ޸ĺóµÄֵΪ-1£¬Ôò¸üбíT¸ÃÐмǼµÄ×Ö¶ÎC2Ϊijֵ¡£
CreateTRIGGER [Tri_UpdateLastSaveDate] ON [dbo].[T]
for UPDATE
AS
BEGIN
if update(C1)
begin
if inserted.C1='-1'
begin
update T set C2=convert(varchar,getdate(),21)
where C3=(select C3 from inserted);
end
end
END
¿ÉÊÇÖ´ÐеÄʱºò×ÜÊDZ¨´í£º
No row was updated.
Error Source:Microsoft.VisualStudio.DataTools.
Error Message: The row value(s) updated or deleted either do not make the row unique or they alter multiple rows(2 rows)
±íTûÓÐÖ÷¼ü£¬ÇÒC3×Ö¶Îʵ¼ÊÊÇΨһֵ
ÎÒ°ÑupdateÕâ¾ä»°È¥µô£¬Ð½¨ÁËÒ»¸ö±íAA£¬°üº¬×Ö¶Îc1¡¢c2£¬Ò²Ã»ÓÐÖ÷¼ü¡£
Ìæ»»³Éupdate AA set AA.C1='99' from AA,Inserted
where AA.C1=Inserted.C1
¿ÉÊÇ»¹ÊÇÌáʾÕâÑùµÄ´íÎó¡£
Çë°ïæ½â¾ö£¬×ż±¡£Ð»Ð»¡£
SQL code:
CreateTRIGGER [Tri_UpdateLastSaveDate] ON [dbo].[T]
for UPDATE
AS
BEGIN
if update(C1)
begin
update T set C2=convert(varchar,getdate(),21)
from T,inserted i
where T.C3=i.C3
and i.C1='-1';
end
END
SQL code
Code highlighting produced by Actipro CodeHighlighter (freeware
Ïà¹ØÎÊ´ð£º
Java code:
Ôõô½«ÏñÏÂÃæµÄ´øÌØÊâ×Ö·û(µ¥ÒýºÅ¡¢°Ù·ÖºÅ£¬Ë«ÒýºÅ£¬#ºÅ£¬ÃÀÔª·ûºÅ......)µÄ×Ö·û´®´æÈësqlserverµÄij¸ö×ֶΣ¿
String mystring="
insert into T_PUB_RZGL(N_RZID,N_RZLX,N_BMDM,N_YGGH,C_RZNR ......
ÎÒÏëÔÚÁíһ̨»úÆ÷ÉÏ·ÃÎʱ¾»úµÄsqlserver 2005 ¸ÃÔõôÅäÖá£Òª·ÃÎʵĻúÆ÷°²×°ÁËsqlserver 2005ÓõIJÙ×÷ϵͳÊÇwindows 2003 £¬Òª½øÐÐÔ¶³Ì·ÃÎʵĻúÆ÷Ò²°²×°ÁËsqlserver 2005 ÓõIJÙ×÷ϵͳÊÇwindows £Ø£Ð¡£¸ÃÔõôÅäÖòÅÄ ......
ÈçºÎ½«sqlserver ±íµÄÒ»¸ö×ֶεÄÖµ¼ÓÉÏͬһ¸öÖµ£¿
ÊÇÉí·ÝÖ¤µ¼³öexcel±ä¿Æѧ¼ÆÊý·¨£¬Ï뽫ÕâÒ»×ֶεÄÖµÖ±½Ó¼ÓÉÏÒ»¸ö ¡¯
ÇëÎÊÈçºÎд£¿
SQL code:
update ry set Éí·ÝÖ¤ºÅ=Éí·ÝÖ¤ºÅ+'*'
UPdateÒ»Ï ......
sqlserver´æ´¢¹ý³Ì¸Äoracle
˻ᰡ¡£¡£¡£°ïæ¸Ä¸Ä··
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
ALTER PROCEDURE tp_Fetch_List(
  ......
ÔÊý¾Ý£º
¾¹ý´ËsqlÓï¾ä²éѯ³öÀ´µÄ½á¹ûÊÇ£º
SQL code:
select Code, Name=stuff((select ','+Name from C t where Code=C.Code for xml path('')), 1, 1, '')
from C
¼ÓÉÏG ......