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

SQLSERVER¼òµ¥´¥·¢Æ÷

 INSERT´¥·¢Æ÷
    INSERT¼°UPDATE´¥·¢Æ÷¾­³£ÓÃÓÚ¼ì²â´¥·¢Æ÷Ëù¼à¿Ø±íµÄÁм°ÆäÊý¾ÝÊÇ·ñ·ûºÏËù¶¨ÒåµÄ¹æÔò¡£ËüÃÇ¿ÉÒÔÔÚÊý¾ÝÊäÈë±í֮ǰ£¬¶ÔÆä½øÐÐÔÚ¶¨ÒåÒýÓÃÍêÕûÐÔʱÎÞ·¨Íê³ÉµÄÔ¼Êø¼ìÑé¡£
    ÏÂÃæÒÔѧÉúÊý¾Ý¿âstudentΪÀýÀ´½éÉÜINSERT´¥·¢Æ÷µÄʹÓ᣸ÃÊý¾Ý¿â°üÀ¨Èý¸ö±í£¬·Ö±ðÊÇÃèÊöѧÉúÇé¿öµÄ“ѧÉúµµ°¸”±í¡¢ÃèÊöѧÉú³É¼¨µÄ“ѧÉú³É¼¨”±ístudentºÍ¡£ÃèÊö·Ö×éÇé¿öµÄ“·Ö×éÇé¿ö”±ígro¡£
 
 
create table student (id numeric(1,0),name varchar(10),sex char(4),class varchar(10),gro numeric(1,0) )
create table gro (class varchar(10),gro numeric(1,0) ,num tinyint)
 
ΪÉÏÃæµÄ“ѧÉúµµ°¸” ±í´´½¨Ò»¸öINSERT´¥·¢Æ÷instrg£¬Æä×÷ÓÃÊÇÿÐÂÔöÒ»ÃûѧÉú¶øÐèÏò“ѧÉúµµ°¸”±íÖвåÈëÐÂÐÐʱ£¬ÔÚ“·Ö×éÇé¿ö”±íÖн«ÆäËùÔÚС×éµÄÈËÊý×Ô¶¯Ôö¼Ó1¡£
 
use mlh
Create Trigger instrg ON [dbo].[student]
FOR Insert
AS
declare @°à¼¶ varchar(50) ,@С×é varchar(50),@ÈËÊý tinyint
select @°à¼¶ = inserted.class,@С×é = inserted.gro from inserted
if exists(select num from gro where @°à¼¶ = gro.class and @С×é= gro.gro)
begin --bg1
select @ÈËÊý = num from gro where @°à¼¶= gro.class and @С×é = gro.gro
set @ÈËÊý = @ÈËÊý + 1
update gro set num = @ÈËÊý where @°à¼¶ = gro.class and @С×é = gro.gro
end --bg1
 
else
begin --bg2
insert gro values(@°à¼¶,@С×é,1)
end --bg2
 
UPDATE ´¥·¢Æ÷
Create Trigger stup On [dbo].[student]
FOR update
AS
Declare @°à¼¶ varchar(50) , @С×é numeric(1,0),@ÈËÊý tinyint
select @°à¼¶ = inserted.class ,@С×é= inserted.gro from inserted
if exists(select * from gro where @°à¼¶  = gro.class and @С×é = gro.gro)
begin
   update gro set gro.num = gro.num + 1 where @°à¼¶  = gro.class and @С×é = gro.gro
end
else
begin
   insert into gro values(@°à¼¶,@С×é,1)
end
select @°à¼¶ = deleted.class ,@С×é= deleted.gro from deleted
select @ÈËÊý = gro.num from gro where  @°à¼¶  = gro.class and @С×é = gro.gro
if @ÈËÊý > 1
begin
&


Ïà¹ØÎĵµ£º

£¨c#£©ExcelÓëSqlServer¼äÊý¾ÝÏ໥µ¼Èë

          ÔÚÊý¾Ý¿â±à³ÌÖУ¬³£»áÓöµ½Òª°ÑÊý¾Ý¿â±íÐÅÏ¢µ¼ÈëExcelÖУ¬  ÓÐʱÔòÊÇ°ÑExcelÄÚÈݵ¼ÈëÊý¾Ý¿âÖС£ÔÚÕâÀ½«½éÉÜÒ»ÖֱȽϷ½±ã¿ì½ÝµÄ·½Ê½£¬Ò²ÊDZȽÏÆÕ±éµÄ¡£Æäʵ£¬Õâ·½·¨Äã²¢²»Ä°Éú¡£Ô­ÀíºÜ¼òµ¥£¬°ÑÊý¾Ý¿â±í»òExcelÄÚÈݶÁÈ¡µ½datasetÀàÐ͵ıäÁ¿ÖУ¬ÔÙÖð ......

ÎÞ·¨Æô¶¯SqlServer·þÎñÆ÷ÁËÔõô°ì£¿

SERVER Í£Ö¹,ÎÞ·¨Æô¶¯,¹ýÆÚÁË (ÆÀ¹À°æ2000)(2008-04-25 22:31:17)±êÇ©£ºsql server ÎÞ·¨Æô¶¯ ¹ýÆÚ ½â¾ö·½·¨ it   
µ± SQL Server 2000 ÆÀ¹À°æµÄ 120 ÌìÆÀ¹ÀÆÚ¹ýÆÚºó£¬SQL Server ½«ÎÞ·¨Æô¶¯¡£
ÔÚ Windows ʼþ²é¿´Æ÷Ó¦ÓóÌÐòÈÕÖ¾ÖУ¬Äú¿ÉÄܻῴµ½ÏÂÃæµÄ´íÎó£º
SQL Server evaluation period has expired ......

SQL LIKE ͨÅä·ûËæ±Ê £¨SqlServer£©

ͨÅä·û ˵Ã÷
_    ÓëÈÎÒâµ¥×Ö·ûÆ¥Åä
 
%    Óë°üº¬Ò»¸ö»ò¶à¸ö×Ö·ûµÄ×Ö·û´®Æ¥Åä
 
[ ]  ÓëÌض¨·¶Î§£¨ÀýÈ磬[a-f]£©»òÌض¨¼¯£¨ÀýÈ磬[abcdef]£©ÖеÄÈÎÒâµ¥×Ö·ûÆ¥Åä¡£
 
[^]  ÓëÌض¨·¶Î§£¨ÀýÈ磬[^a-f]£©»òÌض¨¼¯£¨ÀýÈ磬[^abcdef]£©Ö®ÍâµÄÈÎÒâµ¥×Ö·ûÆ¥Åä¡£
......

ExcelµÄÊý¾Ýµ¼Èëµ½sqlserverÊý¾Ý¿â

  ½ñÌìÔÚ¸ø¹«Ë¾×öÍøվʱ£¬Ö÷¹Ü¸øÁËÒ»¸öеÄÐèÇó¸øÎÒ£¬ÓÉÓÚ¹«Ë¾µÄµç»°±íÊý¾Ý±È½Ï¶à£¬ÐèÒªµ¼Èëµ½Êý¾Ý¿â±íÖУ¬ËùÒÔÌØÒâµÄ´ÓÍøÉϲéÔÄÁËһЩ×ÊÁÏ£¬¼òÒ×µÄдÁ˸ö´ÖÂÔµÄÀ࣬»ù±¾Ô­ÀíÊÇ£º°ÑExcel×öΪÊý¾ÝÔ´£¬ÐγÉdatable¶ÔÏó£¬ È»ºóÔÚÊý¾Ý¿â½¨Á¢Ò»ÕűíÒ»ÁÐÒ»ÁеĽ«Êý¾ÝÌí¼Óµ½Ð±íÖУ¬ÊµÏÖµÄÀࣺ
 using System;
using S ......

ÓÃasp.net»¹Ô­Óë»Ö¸´sqlserverÊý¾Ý¿â

  
ÉÏ´Î×öÁ˸öÏîÄ¿£¬Éæ¼°µ½Êý¾Ý¿âµÄ»¹Ô­ºÍ»Ö¸´£¬µ½ÍøÉÏÕÒÁËһϣ¬ÊÇÀûÓÃSQLDMOʵÏֵģ¬Ö»ÒªÌí¼ÓSQLDMOÒýÓþͺÃÁË£¬È»ºóÀûÓÃϱߵÄÀàµÄ·½·¨¾Í¿ÉÒÔʵÏÖÁË¡£
ÎÒ°ÑÔ­×÷ÕßµÄÀàÀ©³äÁËһϣ¬¿ÉÒÔ×Ô¶¯Ê¶±ðweb.configÀï µÄÊý¾Ý¿âÁ¬½Ó×Ö·û´®£¬¿ÉÒÔͨ¹ý±äÁ¿ÉèÖû¹Ô­»Ö¸´µÄÐÅÏ¢¡£
ÐèҪעÒâµÄʱ»¹Ô­£¬»¹Ô­µÄʱºòÎÊÌ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ