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

ÀûÓÃsqlÓï¾ä´´½¨job

дÁËÒ»¶ÎÀý×Ó£¬Í¨¹ýsql´´½¨Ò»¸öjob£¬¶¨ÆÚÖ´ÐÐһЩÇå³ý¹¤×÷¡£ÔÚsql2005ÉϲâÊÔͨ¹ý¡£
sql°ïÖúÎĵµÌ«ÁãÉ¢ÁË¡£ÕâÊÇÒ»¸öÍêÕûµÄÁ÷³Ì¡£²»¹ý×¢ÒⶨʱִÐÐʱÐèÒªsql server agent·þÎñÆ÷Æô¶¯µÄ¡£
USE msdb ;
GO
EXEC dbo.sp_add_job
@job_name = N'Clear oldest HB',
@enabled = 1,
@description = N'Clear heartbeating data older than one month',
@notify_level_eventlog = 3;
GO
EXEC sp_add_jobstep
@job_name = N'Clear oldest HB',
@step_name = N'Clear Data',
@database_name = N'HINAMIIS',
@subsystem = N'TSQL',
@command = N'DELETE from dbo.JobTest WHERE DATEDIFF(DAY, dbo.JobTest.inserttime, GETDATE()) >=30',
@retry_attempts = 1,
@retry_interval = 5 ;
GO
EXEC sp_add_schedule
@schedule_name = N'WeeklyClearJobs' ,
@freq_type = 8,
@freq_interval = 1,
@freq_recurrence_factor = 1,
@active_start_time = 100000 ;
GO
EXEC sp_attach_schedule
@job_name = N'Clear oldest HB',
@schedule_name = N'WeeklyClearJobs' ;
GO
EXEC dbo.sp_add_jobserver
@job_name = N'Clear oldest HB'
GO


Ïà¹ØÎĵµ£º

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃæ£¬ºóÃæ ......

SQL ServerÊý¾ÝÀàÐͽéÉÜ

ÔÚ¼ÆËã»úÖÐÊý¾ÝÓÐÁ½ÖÖÌØÕ÷£ºÀàÐͺͳ¤¶È¡£ËùνÊý¾ÝÀàÐ;ÍÊÇÒÔÊý¾ÝµÄ±íÏÖ·½Ê½ºÍ´æ´¢·½Ê½À´»®·ÖµÄÊý¾ÝµÄÖÖÀà¡£
    ÔÚSQL Server ÖÐÿ¸ö±äÁ¿¡¢²ÎÊý¡¢±í´ïʽµÈ¶¼ÓÐÊý¾ÝÀàÐÍ¡£ÏµÍ³ÌṩµÄÊý¾ÝÀàÐÍ·ÖΪ¼¸´óÀ࣬Èç±í4-2 Ëùʾ¡£

    ÆäÖУ¬BIGINT¡¢ SQL_VARIANT ºÍTABLE ÊÇSQL Server 2000 ÖÐÐ ......

SQL ServerÊý¾Ý¿âË鯬

µ±Ë÷ÒýËùÔÚÒ³ÃæµÄ»ùÓÚÖ÷¹Ø¼ü×ÖµÄÂß¼­Ë³Ðò£¬ºÍÊý¾ÝÎļþÖеÄÎïÀí˳Ðò²»Æ¥Åäʱ£¬Ë鯬¾Í²úÉúÁË¡£ËùÓеÄÒ¶¼¶Ò³°üº¬ÁËÖ¸Ïòǰһ¸öºÍºóÒ»¸öÒ³µÄÖ¸Õë¡£ÕâÑù¾Í
ÐγÉÒ»¸öË«Á´±í¡£ÀíÏëÇé¿öÏ£¬Êý¾ÝÎļþÖÐÒ³µÄÎïÀí˳Ðò»áºÍÂß¼­Ë³ÐòÆ¥Åä¡£Õû¸ö´ÅÅ̵Ť×÷ÐÔÄÜÔÚÎïÀí˳ÐòÆ¥ÅäÂß¼­Ë³Ðòʱ½«ÏÔÖøÌáÉý¡£¶ÔÄ³Ð©ÌØ¶¨µÄ²éѯ¶øÑÔ£¬
Õ⽫´øÀ´¼«¼ÑµÄ ......

SQL Server ÃæÊÔÌâ £¨³ÖÐø¸üÐÂÖÐ...£©

3¡£±íÄÚÈÝÈçÏÂ
¡¡¡¡-----------------------------
¡¡¡¡ID LogTime
¡¡¡¡1 2008/10/10 10:00:00
¡¡¡¡1 2008/10/10 10:03:00
¡¡¡¡1 2008/10/10 10:09:00
¡¡¡¡2 2008/10/10 10:10:00
¡¡¡¡2 2008/10/10 10:11:00
¡¡¡¡......
¡¡¡¡-----------------------------
¡¡¡¡ÇëÎʸ÷λ¸ßÊÖ£¬ÈçºÎ²éѯµÇ½ʱ¼ä¼ä¸ô²»³¬ ......

ÈçºÎ¿ªÆôSQL CLR

 ÈçºÎ¿ªÆôSQL CLR
 
¿ªÆôSQL CLRÓÐÁ½²½²Ù×÷£¬ÈçÏÂËùʾ£º
1.       ¿ªÆôSQLCLR£¬ÔÚsql server2005ÖÐÖ´ÐÐÈçϽű¾£¬¿ªÆôSQL CLR¹¦ÄÜ
EXEC sp_configure 'show advanced options' , '1';
go
reconfigure;
go
EXEC sp_configure 'clr enabled' , '1'
go
reconfigure;
-- Tu ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ