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

Çósql´¥·¢Æ÷Óï¾ä

users±í
name  companyId  companyName


company±í
companyId  companyName
1          a¹«Ë¾
2          b¹«Ë¾

µ±Ìí¼Óuser±íʱ,¸ú¾ÝËùÌîµÄusers.comapnyId,Óô¥·¢Æ÷²úÉúusers.companyName¶ÔÓ¦µÄcompany±íµÄcompanyNameÖµ


select companyName from company where companyId =@companyId 

SQL code:
create trigger tri_users_insert
on users
instead of insert
as
begin
insert users
select i.name,i.companyId,c.companyName
from inserted i,company c
where i.companyId=c.companyId
end

»òÕß²»ÓÃinstead of£¬²åÈëºóÓô¥·¢Æ÷½øÐиüÐÂ

SQL code:
create trigger tri_users_insert
on users
after insert
as
begin
update u
set u.companyName=c.companyName
from users u,inserted i,company c
where i.companyId=c.companyId and i.companyId=u.companyId
end


Ö§³Ö

ѧϰ

×îºó²»ÒªÓô¥·¢Æ÷ÁË,ÓÃÍâ¼ü¹ØÁª,ÊÖ¶¯Ìí¼Ó.·½±ãʵÓÃ,ά»¤Ò²ºÜºÃ


Ïà¹ØÎÊ´ð£º

sqlÓï¾äÎÊÌâ

ÓÐÒ»¸ö±íAA
name  tj
1    a
1    b
1    c
2    a
2    d
3    b
ÒªÇóµ±tj×ֶεÄÖµ¼ÈµÈÓÚaÓÖµÈÓÚcʱ£¨tj = ¡®a¡ ......

sql server 2000 µÇ¼ʧ°Ü

µã»÷¡°·þÎñ¹ÜÀíÆ÷¡±£¬µã»÷¡°¿ªÊ¼/¼ÌÐø¡±£¬×ÜÊÇÏÔʾ¡°ÓÉÓڵǼʧ°Ü¶øÆô¶¯·þÎñ¡±£¬È»ºóÔٴγö´í£¬²»Äܹ»½øÈ룬Ҳ²»Äܹ»²é¿´ÊôÐÔ£¬ÇëÎÊ´ó¼Ò¸ÃÔõô°ì£¿

ÎÒÊDzſªÊ¼Ñ§Ï°Êý¾Ý¿â£¬ÇëÎÊ´ó¼ÒÓÐûÓÐʲôºÃһЩµÄ½¨Òé»òÕ ......

Çó Æ´VB SQL insert into ×Ö·û´®

  INSERT INTO StudAchieve(studID,studName)
  VALUES('2','abc'),('2','bcd'),('2','cde')

  Æ´ÁË°ëÌìÒ²²»¶Ô£¬¼°°¡ ¡£¡£¡£¡£
SQL c ......

ÓÐÈËÓùýsql server2005 ´´½¨·¢²¼Âð£¿

¾ÍÊÇÕ¹¿ªreplication ÓÒ¼üµ¥»÷ local Subscription ´´½¨·¢²¼£¬ ÓÐÈËÓùýÂ𣬳ɹ¦´´½¨·¢²¼µÄÓÐÂð£¿
Óùý£¬¿ÉÒԳɹ¦

ÒýÓÃ
Óùý£¬¿ÉÒԳɹ¦

Ã×ÓùýµÄ°ï¶¥

ÒýÓÃ
Óùý£¬¿ÉÒԳɹ¦

µÚÒ»²½ÎҾ͹ý² ......

ÇóÖúÒ»¾äSQLÓï¾ä

Êý¾ÝÀàÐÍ£º
Code char(6)
CreateTime datetime
Price float

Êý¾ÝÈçÏ£º

Code      CreateTime          Price
031002 2008-10-17 15:00:15 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ