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

SQLServerÖжÔËùÓеÄÓû§±íÉú³É´¥·¢Æ÷

²âÊÔµÄʱºò±È½ÏÖØÒª£¬ÎÒÃÇ¿ÉÒÔÖªµÀµ±Ç°½»Ò×Ó°ÏìÁËÄÄЩ±í
--ÓÃÓڼǼÓû§ÔÚµ±Ç°±íÉÏʲôʱºò¡¢×öµÄʲô²Ù×÷£ºupdate¡¢insert¡¢delete
create table TriggerRecord
(
 operdt datetime, --´¥·¢Ê±¼ä
 opertp varchar(10), --²Ù×÷ÀàÐÍ£ºupdate¡¢insert¡¢delete
 opertb varchar(50) --±íÃû
)
--Õâ¸ö±íÓÚÓñ£´æÉú³ÉµÄ´¥·¢Æ÷Óï¾ä£¬ÔÚ¹ý³ÌÖÐÑ­»·Ö´ÐÐ
--ÒòΪSqlserver²»ÔÊÐíÔÚÒ»¸öÅú´ÎͬʱִÐжàÌõcreate triggerÓï¾ä
create table T(sqlTrigger varchar(500))
--Ñ­»·Ö´ÐдæÓÚ±íÖд¥·¢Æ÷µÄ´æ´¢¹ý³Ì
create proc loopExecTrigger
as
begin
 declare @sql varchar(500)
 declare cur cursor for select sqlTrigger from T
 open cur
 fetch cur into @sql
 while @@fetch_status=0
 begin
  execute(@sql)
  fetch cur into @sql
 end
 close cur
 deallocate cur
 delete T
end
--ÓÃÓÚÉú³É²åÈëÓï¾äµÄ´¥·¢Æ÷£¬²¢½«´¥·¢Æ÷Óï¾ä±£´æµ½±íÖÐ
select 'insert into T values(''create trigger T_'+name+' on '+name+' for insert as insert into TriggerRecord values(getdate(),''''insert'''','''''+name+''''');'')' from sysobjects where type='U' and name not in('T','TriggerRecord')
--½«ÒÔÉÏÉú³ÉµÄÓï¾ä¿½±´³öÀ´Ö´ÐÐ
--ÓÃÓÚÉú³É¸üÐÂÓï¾äµÄ´¥·¢Æ÷£¬²¢½«´¥·¢Æ÷Óï¾ä±£´æµ½±íÖÐ
select 'insert into T values(''create trigger T_'+name+'_U on '+name+' for update as insert into TriggerRecord values(getdate(),''''update'''','''''+name+''''');'')' from sysobjects where type='U' and name not in('T','TriggerRecord')
--½«ÒÔÉÏÉú³ÉµÄÓï¾ä¿½±´³öÀ´Ö´ÐÐ
--ÓÃÓÚÉú³Éɾ³ýÓï¾äµÄ´¥·¢Æ÷£¬²¢½«´¥·¢Æ÷Óï¾ä±£´æµ½±íÖÐ
select 'insert into T values(''create trigger T_'+name+'_D on '+name+' for delete as insert into TriggerRecord values(getdate(),''''delete'''','''''+name+''''');'')' from sysobjects where type='U' and name not in('T','TriggerRecord')
--½«ÒÔÉÏÉú³ÉµÄÓï¾ä¿½±´³öÀ´Ö´ÐÐ
--Ö´ÐÐͨ¹ýÉÏÃæÓï¾äÉú³ÉµÄÓï¾äºó£¬ÔÙÖ´Ðд洢Éú³É´¥·¢Æ÷µÄ´æ´¢¹ý³Ì
exec loopExecTrigger
--Éú³Éɾ³ýÈ«²¿ÒÔT¿ªÍ·µÄ´¥·¢Æ÷µÄÓï¾ä
select 'drop trigger '+name+';' from sysobjects where type='TR' and name l


Ïà¹ØÎĵµ£º

SQLServerÊý¾Ý¼¯ºÏµÄ½»¡¢²¢¡¢²î¼¯ÔËËã

SQLServer2005ͨ¹ýintersect,union,exceptºÍÈý¸ö¹Ø¼ü×Ö¶ÔÓ¦½»¡¢²¢¡¢²îÈýÖÖ¼¯ºÏÔËËã¡£
ËûÃǵĶÔÓ¦¹Øϵ¿ÉÒԲο¼ÏÂÃæͼʾ
       Ïà¹Ø²âÊÔʵÀýÈçÏ£º
use tempdb
go
if (object_id ('t1' ) is not null ) drop table t1
if (object_id ('t2' ) is not null ) drop table t2
go
cre ......

SQLserver×Ö·û´®·Ö¸îº¯Êý

SQLserver×Ö·û´®·Ö¸îº¯Êý
Ò»¡¢°´Ö¸¶¨·ûºÅ·Ö¸î×Ö·û´®£¬·µ»Ø·Ö¸îºóµÄÔªËظöÊý£¬·½·¨ºÜ¼òµ¥£¬¾ÍÊÇ¿´×Ö·û´®ÖдæÔÚ¶àÉÙ¸ö·Ö¸ô·ûºÅ£¬È»ºóÔÙ¼ÓÒ»£¬¾ÍÊÇÒªÇóµÄ½á¹û¡£
CREATE function Get_StrArrayLength
(
  @str varchar(1024),  --Òª·Ö¸îµÄ×Ö·û´®
  @split varchar(10)  --·Ö¸ô·ûº ......

ISA·À»ðǽ¿Í»§¶ËºÍSQLSERVER¿Í»§¶ËµÄÎÊÌâ

ÓÐÍâÀ´³ÌÐò°²×°»ùÓÚ.NET FRAMEWORK 3.5µÄÓ¦ÓóÌÐòÔÚÄÚÍøµÄPCÉÏ£¬ÐèҪͨ¹ýISA·À»ðǽ¿Í»§¶Ë¾­¹ý·þÎñÆ÷ÉϵÄISA2006 SP1·ÃÎÊÍâÍøµÄSQLSERVER2005Êý¾Ý¿â¡£
        °´ÕÕÒÔÍù¾­Ñ飬ÐèÒªÅäÖÃÒ»ÌõSQLSERVER2005·þÎñÆ÷ËùÔÚµÄIPµØÖ·µÄ³öÕ¾¹æÔò£¬²¢ÇÒ²¢²»ÐèÒªÉèÖÃÒ»Ìõ»ùÓÚÓòÃûµÄ¹æÔò¡£
 &nb ......

Flex+JavaÁ¬½ÓSQLServerÊý¾Ý¿â

 Ê×ÏÈ£¬×öÒ»µã˵Ã÷¡£FlexÊDz»ÄÜÖ±½ÓÁ¬½ÓÊý¾Ý¿âµÄ£¬ÕâÒ»µã´ó¼ÒÐèÒªÖªµÀ£¬ËüÖ»Äܼä½ÓµØÁ¬½ÓÊý¾Ý¿â¡£FlexÖÐÌṩÁËÈýÖÖ·½Ê½£ºHttpService£¬WebService ºÍRemoteObject¡£ÆäÖÐHttpService¿ÉÒÔÖ±½Ó»ñÈ¡XMLÖеÄÊý¾Ý£¬»¹¿ÉÒÔͨ¹ýJSP,ASPÒÔ¼°PHP¶ÁÈ¡Êý¾Ý¿âÖеÄÊý¾Ý£¬Õâ¸ö±È½Ï¼òµ¥£¬¶øÇÒÍøÉÏÒ²ÓкܶàÀý×Ó£¬ÎҾͲ»¶à˵ÁË¡£WebServi ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ