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

MSSQLÖмÆËãÁ½¸öÈÕÆÚÖ®¼äÏà¸ô xxÌìxxСʱxx·ÖxxÃë

 DECLARE @dt1 AS datetime, @dt2 AS datetime;
SELECT @dt1 = '2008-8-4 9:36:41', @dt2 = '2008-8-2 9:33:39';
DECLARE @Days AS int, @Hours AS int, @Minutes AS int, @Seconds AS int;
SET @Seconds = DATEDIFF( second, @dt2, @dt1);
SET @Days = @Seconds / (24 * 60 * 60)
SET @Seconds = @Seconds - @Days * 24 * 60 * 60
SET @Hours = @Seconds / (60 * 60);
SET @Seconds = @Seconds - @Hours * 60 * 60
SET @Minutes = @Seconds / 60;
SET @Seconds = @Seconds - @Minutes * 60;
SELECT CONVERT(varchar(10), @Days ) + 'Ìì'
          + CONVERT(varchar(10), @Hours ) + 'Сʱ'
          + CONVERT(varchar(10), @Minutes ) + '·Ö'
          + CONVERT(varchar(10), @Seconds ) + 'Ãë';


Ïà¹ØÎĵµ£º

MSSQLµÄ¶à²ãǶÌײéѯ

½ñÌìÔÚÁÄÌìϵͳÖÐÐèҪϵͳִÐÐÒ»¸ö¶à²ãǶÌײéѯ¡£
Ò»¿ªÊ¼Óï¾äÈçÏÂ×ܳöÏÖ´íÎó£ºÔ­À´ÊÇÔÚ]='123') ºóÎÒ¶à¼ÓÁËÒ»¸ö as tb1
¸ÄΪÈçϺó£¬ÕýÈ·ÔËÐС£
select * from ( select top(10)  * from ( select top(100)  * from (select  [chatcontent].[senderid],[chatcontent].[id] ,[chatcontent].[toid] ,[chatc ......

»ùÓÚmssql °ÙÍò¼¶ Êý¾Ý ²éѯ ÓÅ»¯ ¼¼ÇÉÈýÊ®Ôò

1.¶Ô²éѯ½øÐÐÓÅ»¯£¬Ó¦¾¡Á¿±ÜÃâÈ«±íɨÃ裬Ê×ÏÈÓ¦¿¼ÂÇÔÚ where ¼° order by Éæ¼°µÄÁÐÉϽ¨Á¢Ë÷Òý¡£
2.Ó¦¾¡Á¿±ÜÃâÔÚ where ×Ó¾äÖжÔ×ֶνøÐÐ null ÖµÅжϣ¬·ñÔò½«µ¼ÖÂÒýÇæ·ÅÆúʹÓÃË÷Òý¶ø½øÐÐÈ«±íɨÃ裬È磺
select id from t where num is null
¿ÉÒÔÔÚnumÉÏÉèÖÃĬÈÏÖµ0£¬È·±£±íÖÐnumÁÐûÓÐnullÖµ£¬È»ºóÕâÑù²éѯ£º
select id ......

MSSQLÊý¾ÝÀàÐͼ°³¤¶ÈÏÞÖÆÏêϸ˵Ã÷

SQL Server ÌṩϵͳÊý¾ÝÀàÐͼ¯£¬¶¨ÒåÁË¿ÉÓë SQL Server Ò»ÆðʹÓõÄËùÓÐÊý¾ÝÀàÐÍ¡£ÏÂÃæÁгöϵͳÌṩµÄÊý¾ÝÀàÐͼ¯¡£
¿ÉÒÔ¶¨ÒåÓû§¶¨ÒåµÄÊý¾ÝÀàÐÍ£¬ÆäÊÇϵͳÌṩµÄÊý¾ÝÀàÐ͵ıðÃû¡£ÓйØÓû§¶¨ÒåµÄÊý¾ÝÀàÐ͵ĸü¶àÐÅÏ¢£¬Çë²Î¼û sp_addtype ºÍ´´½¨Óû§¶¨ÒåµÄÊý¾ÝÀàÐÍ¡£
µ±Á½¸ö¾ßÓв»Í¬Êý¾ÝÀàÐÍ¡¢ÅÅÐò¹æÔò¡¢¾«¶È¡¢Ð¡ÊýλÊý»ò³ ......

MSSQLÊý¾Ý¿âÖз¢ÏÖD99_tmp±íµÄ´¦Àí·½·¨

ÏàÐźܶàASP+MSSQLµÄÍøÕ¾¶¼Óб»ÈË×¢Èë¹ýµÄ¾­Àú£¬Êý¾Ý¿â±íÖжàÁËһЩ±í£¬ÀàËÆÒÔϵıíD99_tmp,D99_cmd£¬kill_kk¡£
D99_tmp£¨subdirectory,depth,fileÈý¸ö×ֶΣ¬ÀïÃæµÄÊý¾Ý¶¼ÊÇÍøÕ¾ÎļþºÍĿ¼£©
MSSQLÊý¾Ý¿â´æÔÚ¼¸¸öΣÏÕµÄÀ©Õ¹´æ´¢¹ý³Ì£¬Ä¬ÈÏPublic×é¿ÉÖ´ÐÐȨÏÞ£¬SQL×¢ÈëÕß¿ÉÀûÓô˶ÁÈ¡ÎļþĿ¼¼°Óû§×飬²¢¿Éͨ¹ýÏÈдÈëÊý¾ ......

ÓÃ×÷ҵʵÏÖ×Ô¶¯±¸·ÝMSSQLÊý¾Ý¿âµ½Ô¶³Ì·þÎñÆ÷

--´Ë´úÂëʵÏÖSQLÊý¾Ý¿âÔ¶³Ì±¸·Ý£¬·Åµ½×÷ÒµÀïÃæÖ´ÐпÉÒÔ×Ô¶¯±¸·ÝÊý¾Ý¿â¡¢×Ô¶¯É¾³ý@keepNDaysÌìÇ°±¸·Ý¡£
--´Ë´úÂ뽫±¾µØËùÓеÄÓû§Êý¾Ý¿â±¸·Ýµ½¹²ÏíĿ¼¡°\\backupServerIp\ShareName\Êý¾Ý¿â±¸·Ý¡±Ï¡£
--²¢É¾³ýÌìÇ°µÄ±¸·ÝÎļþ¡£Òª±¸·Ý³É¹¦±ØÐëÄܹ»¶Ô¹²ÏíĿ¼ÓвÙ×÷ȨÏÞ£¡

sp_configure 'xp_cmdshell',1 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ