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

²é¿´sql server lock


 drop   table   #t  
  create   table   #t(req_spid   int,obj_name   sysname)   
  declare   @s   nvarchar(4000)   
  ,@rid   int,@dbname   sysname,@id   int,@objname   sysname   
  declare   tb   cursor   for     
  select   distinct   req_spid,dbname=db_name(rsc_dbid),rsc_objid   
  from   master..syslockinfo   where   rsc_type   in(4,5)   
  open   tb   
  fetch   next   from   tb   into   @rid,@dbname,@id   
  while   @@fetch_status=0   
  begin   
  set   @s='select   @objname=name   from   ['+@dbname+']..sysobjects   where   id=@id'   
  exec   sp_executesql   @s,N'@objname   sysname   out,@id   int',@objname   out,@id   
  insert   into   #t   values(@rid,@objname)   
  fetch   next   from   tb   into   @rid,@dbname,@id   
  end   
  close   tb   
  deallocate   tb   
  select   ½ø³Ìid=a.req_spid   
  ,Êý¾Ý¿â=db_name(rsc_dbid)   
  ,ÀàÐÍ=case   rsc_type   when   1   then   'NULL   ×ÊÔ´£¨Î´Ê¹Óã©'   
  when   2   then   N'Êý¾Ý¿â'   
  when   3   then   N'Îļþ'   
  when   4   then   N'Ë÷Òý'   
  when   5   then   N'±í'   
  when   6   then   N'Ò³'   
  when  


Ïà¹ØÎĵµ£º

SQLSERVER SQLÐÔÄÜÓÅ»¯

1.Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)¡¡¡¡
¡¡¡¡ SQLSERVERµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í£¬µ±SQLSERVER´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á ......

sqlÓï¾ä ½ØÈ¡Ê±¼ä Ö»ÏÔʾ Ä꣬Ô£¬Èյĸñʽ


Õª×Ôhttp://blog.sina.com.cn/zhm85
SQLÓï¾ä½ØÈ¡Ê±¼ä£¬Ö»ÏÔʾÄêÔÂÈÕ£¨2004-09-12£©
select CONVERT(varchar, getdate(), 120 )
‘getdate£¨£©’¸ÄΪʱ¼ä×Ö¶ÎÃû‘createtime’
ÔÙÖØÃüÃûмÓÁУ¨Select Name AS UName from Users£©
ÀýÈç select convert(varchar(11),createtime,120) as Ndate fro ......

SQL SERVER 2005 ¸ß¼¶²éѯ£¨×Ó²éѯ²éѯ£©

--SQL¸ß¼¶³ÌÐòÉè¼Æ£º×Ó²éѯ
use AdventureWorks
GO
SELECT DISTINCT EmployeeID from HumanResources.JobCandidate WHERE EmployeeID IS NOT NULL;
SELECT e.EmployeeID,FirstName,LastName
from HumanResources.Employee e
INNER JOIN Person.Contact c
 ON e.ContactID = c.ContactID
WHERE e.EmployeeID IN ......

SQL Server2005 ±í·ÖÇøÈý²½Çú

ǰÑÔ
SQL Server 2005¿ªÊ¼Ö§³Ö±í·ÖÇø£¬ÕâÖÖ¼¼ÊõÔÊÐíËùÓеıí·ÖÇø¶¼±£´æÔÚͬһ̨·þÎñÆ÷ÉÏ¡£Ã¿Ò»¸ö±í·ÖÇø¶¼ºÍÔÚij¸öÎļþ×é(filegroup)Öеĵ¥¸öÎļþ¹ØÁª¡£Í¬ÑùµÄÒ»¸öÎļþ/Îļþ×é¿ÉÒÔÈÝÄɶà¸ö·ÖÇø±í¡£ÔÚÕâÖÖÉè¼Æ¼Ü¹¹Ï£¬Êý¾Ý¿âÒýÇæÄܹ»Åж¨²éѯ¹ý³ÌÖÐÓ¦¸Ã·ÃÎÊÄĸö·ÖÇø£¬¶ø²»ÓÃɨÃèÕû¸ö±í¡£Èç¹û²éѯÐèÒªµÄÊý¾ÝÐзÖÉ¢ÔÚ¶à¸ö·ÖÇøÖ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ