²âÊÔMSSQLÖÐSQLÓï¾äÖ´Ðл¨·ÑµÄʱ¼ä
selectÓï¾äÇ°¼Ó£º
declare @d datetime
set @d=getdate()
²¢ÔÚselectÓï¾äºó¼Ó£º
select [Óï¾äÖ´Ðл¨·Ñʱ¼ä(ºÁÃë)]=datediff(ms,@d,getdate())
ת×Ô£º¶¯Ì¬ÍøÖÆ×÷Ö¸ÄÏ www.knowsky.com
ÕâÊǼòÒ׵IJ鿴ִÐÐʱ¼äµÄ·½·¨¡£
===========================================£¨Ò»ÏÂÄÚÈÝת×Ô£º£Ã£Ó£Ä£Î£©
MSSQL ServerÖÐͨ¹ý²é¿´SQLÓï¾äÖ´ÐÐËùÓõÄʱ¼ä£¬À´ºâÁ¿SQLÓï¾äµÄÐÔÄÜ¡£
set statistics profile on
set statistics io on
set statistics time on
go
ÄãÖ´ÐеÄSQLÓï¾ä
go
set statistics profile off
set statistics io off
set statistics time off
Ö´ÐÐÍêºóµãÏûÏ¢¼´¿É¡£
²¹³ä˵Ã÷£º
set statistics io ¼ì²é²éѯËù²úÉúµÄ¶ÁºÍд
set statistics time ¼ì²é²éѯµÄÔËÐÐʱ¼ä
µ±ÔËÐÐÒ»sqlÓï¾ä£¬ÔÚÏûÏ¢ÖлáÏÔʾÈ磺
SQL Server ·ÖÎöºÍ±àÒëʱ¼ä:
CPU ʱ¼ä = 0 ºÁÃ룬ռÓÃʱ¼ä = 10 ºÁÃë¡£
SQL Server ·ÖÎöºÍ±àÒëʱ¼ä:
CPU ʱ¼ä = 0 ºÁÃ룬ռÓÃʱ¼ä = 1 ºÁÃë¡£
(0 ÐÐÊÜÓ°Ïì)
±í ‘t_login_session’¡£É¨Ãè¼ÆÊý 1£¬Âß¼¶ÁÈ¡ 2 ´Î£¬ÎïÀí¶ÁÈ¡ 0 ´Î£¬Ô¤¶Á 0 ´Î£¬lob Âß¼¶ÁÈ¡ 0 ´Î£¬lob ÎïÀí¶ÁÈ¡ 0 ´Î£¬lob Ô¤¶Á 0 ´Î¡£
(3 ÐÐÊÜÓ°Ïì)
SQL Server Ö´ÐÐʱ¼ä:
CPU ʱ¼ä = 0 ºÁÃ룬ռÓÃʱ¼ä = 11 ºÁÃë¡£
SQL Server ·ÖÎöºÍ±àÒëʱ¼ä:
CPU ʱ¼ä = 0 ºÁÃ룬ռÓÃʱ¼ä = 1 ºÁÃë¡£
SQL Server Ö´ÐÐʱ¼ä:
CPU ʱ¼ä = 0 ºÁÃ룬ռÓÃʱ¼ä = 1 ºÁÃë¡£
SQL Server Ö´ÐÐʱ¼ä:
CPU ʱ¼ä = 0 ºÁÃ룬ռÓÃʱ¼ä = 1 ºÁÃë¡£
±í ‘t_login_session’¡£É¨Ãè¼ÆÊý 1£¬Âß¼¶ÁÈ¡ 2 ´Î£¬ÎïÀí¶ÁÈ¡ 0 ´Î£¬Ô¤¶Á 0 ´Î£¬lob Âß¼¶ÁÈ¡ 0 ´Î£¬lob ÎïÀí¶ÁÈ¡ 0 ´Î£¬lob Ô¤¶Á 0 ´Î¡£
Õâ¸öɨÃèͳ¼Æ¸æËßÎÒÃÇɨÃèÖ´ÐеÄÊýÁ¿£¬Âß¼¶ÁÏÔʾµÄÊÇ´Ó»º´æÖжÁ³öÀ´µÄÒ³ÃæµÄÊýÁ¿£¬ÎïÀí¶ÁÏÔʾµÄÊÇ´Ó´ÅÅÌÖжÁµÄÒ³ÃæµÄÊýÁ¿£¬Ô¤¶ÁÏÔʾÁË·ÅÖÃÔÚ»º´æÖÐÓÃÓÚ½«À´¶Á²Ù×÷µÄÒ³ÃæÊýÁ¿¡£
ͨ¹ý¿´ÕâЩÐÅÏ¢ÎÒÃÇÄܵõ½Ð©Ê²Ã´ÄØ£¿
¡ôÕâ¸ö²éѯûÓÐɨÃèÕû¸ö±
Ïà¹ØÎĵµ£º
http://www.cnblogs.com/dwjaissk/archive/2006/07/25/459476.aspx
Ôö¼Ó×Ö¶Î
alter table docdsp add dspcode char(200)
ɾ³ý×Ö¶Î
ALTER TABLE
table_NAME DROP COLUMN column_NAME
ÐÞ¸Ä×Ö¶ÎÀàÐÍ
ALTER TABLE table_name
ALTER COLUMN column_name new_data_type
¸ÄÃû
sp_rename
¸ü¸Äµ±Ç°Êý¾Ý¿âÖÐ ......
1¡¢join
A±íµÄÖ÷¼üÊÇ×÷ΪB±íµÄÍâ¼ü¡£ÔÚ²éѯµÄʱºò£¬¿ÉÒÔͨ¹ý²»Í¬µÄjoin½«AºÍB±íÁ´½ÓÆðÀ´£¬´Ó¶øµÃµ½²»Í¬µÄ²éѯ½á¹û¡£
* JOIN: Èç¹û±íÖÐÓÐÖÁÉÙÒ»¸öÆ¥Å䣬Ôò·µ»ØÐÐ
* INNER JOIN: Èç¹ûÁ½¸ö±íÖÐÓÐÆ¥ÅäµÄ£¬Ôò·µ»ØÐÐ
* LEFT JOIN: ¼´Ê¹ÓÒ±íÖÐûÓÐÆ¥Å䣬Ҳ´Ó×ó± ......
asp.net(C#)ʵÏÖSQL2000Êý¾Ý¿â±¸·ÝºÍ»¹Ô
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.Htm ......
¸Õ×°ÍêÊý¾Ý¿â¾Í±»ÈË·è¿ñɨÃèsa£¬ÎÞ±ÈÓôÃÆ¡£
¸ÄsaÃû³Æ£¬1433¶Ë¿ÚºÅ£¬ÒòΪ¿ª·¢ÐèÒª»¹±ØÐë´ò¿ªÔ¶³ÌÁ¬½Ó£¬½á¹ûÔÚ¿Í»§¶ËÎÞÂÛÈçºÎ¶¼²»ÄÜÁ¬½ÓÉÏ·þÎñÆ÷¡£
¿ñº¹Çë°Ù¶È´óÉñ³öÂí£¬°Ñ¸÷ÖÖÅäÖÃÁ·Á˸öÊ죬½á¹û»¹ÊÇû½â¾ö¡£
¸ãЦµÄÊÇ×îºóÎÞÒâÖÐÔÚMicrosoftÂÛ̳ÉÏ¿´µ½Õâôһ¾ä£¬ÐÞ¸ÄÍê¶Ë¿ÚºÅ£¬ÔÚ¿Í»§¶ËµÇ¼µÄʱºòÒªÔÚIPºóÃ棫¶ººÅ£«¶Ë¿Úº ......
SQL³£ÓÃÃüÁîʹÓ÷½·¨£º
(1) Êý¾Ý¼Ç¼ɸѡ£º
sql="select * from Êý¾Ý±í where ×Ö¶ÎÃû=×Ö¶ÎÖµ order by ×Ö¶ÎÃû [desc]"
sq ......