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

sql³£ÓÃÓï¾ä

ÔÚSQLSERVER£¬¼òµ¥µÄ×éºÏsp_spaceusedºÍsp_MSforeachtableÕâÁ½¸ö´æ´¢¹ý³Ì£¬¿ÉÒÔ·½±ãµÄͳ¼Æ³öÓû§Êý¾Ý±íµÄ´óС£¬°üÀ¨¼Ç¼×ÜÊýºÍ¿Õ¼äÕ¼ÓÃÇé¿ö£¬·Ç³£ÊµÓã¬ÔÚSqlServer2KºÍSqlServer2005Öж¼²âÊÔͨ¹ý¡£
/*
1. exec sp_spaceused '±íÃû'            £¨SQLͳ¼ÆÊý¾Ý£¬´óÁ¿ÊÂÎñ²Ù×÷ºó¿ÉÄܲ»×¼£©
2. exec sp_spaceused '±íÃû', true       (¸üбíµÄ¿Õ¼ä´óС£¬×¼È·µÄ±í¿Õ´óС£¬µ«¿ÉÄܻỨЩͳ¼Æʱ¼ä£©
3. exec sp_spaceused                    (Êý¾Ý¿â´óС²éѯ£©
4. exec sp_MSforeachtable "exec sp_spaceused '?'"     (ËùÓÐÓû§±í¿Õ¼ä±íС£¬SQLͳ¼ÆÊý¾Ý£¬£¬´óÁ¿ÊÂÎñ²Ù×÷ºó¿ÉÄܲ»×¼£©
5. exec sp_MSforeachtable "exec sp_spaceused '?',true"    (ËùÓÐÓû§±í¿Õ¼ä±íС£¬´óÊý¾Ý¿âÉ÷Óã©
*/
create table #t(name varchar(255), rows bigint, reserved varchar(20), data varchar(20), index_size varchar(20), unused varchar(20))
exec sp_MSforeachtable "insert into #t exec sp_spaceused '?'"
select * from #t
drop table #t
ÁíÍ⻹ÓÐsp_MSforeachdb¿ÉÒÔ±éÀúËùÓÐÊý¾Ý¿â£¬Ê¹Ó÷½·¨Ïê¼ûSQL°ïÖú¡£


Ïà¹ØÎĵµ£º

OracleÖ´ÐÐSQLÓï¾äµÄ¹ý³Ì

µ±ÎÒÃÇÌá½»Ò»ÌõsqlÓï¾äʱ£¬oracle»á×öÄÄЩ²Ù×÷ÄØ£¿
Oracle»áΪÿ¸öÓû§½ø³Ì·ÖÅäÒ»¸ö·þÎñÆ÷½ø³Ì£ºservice process£¨Êµ¼ÊÇé¿öÓ¦¸ÃÇø·ÖרÓ÷þÎñÆ÷ºÍ¹²Ïí·þÎñÆ÷£©£¬µ±service process½ÓÊÕµ½Óû§½ø³ÌÌá½»µÄsqlÓï¾äʱ£¬·þÎñÆ÷½ø³Ì»á¶ÔsqlÓï¾ä½øÐÐÓï·¨ºÍ´Ê·¨·ÖÎö¡£
Ãû´Ê½âÊÍ£º
Óï·¨·ÖÎö£ºÓï¾ä±¾ÉíÕýÈ·ÐÔ¡£
´Ê·¨·ÖÎö£º¶ÔÕÕÊ ......

SQLÎÞÏÞ·ÖÀà´æ´¢¹ý³ÌÕûÀí1

Óŵã:×ֶνÏÉÙ£¬ÓÐÔöɾ¸Ä²é¹¦ÄÜ£¬²»¹ý²éѯ̫Áýͳ¡£
ȱµã:
1.²»ËãÊÇÔÚºÜÕýµÄÎÞÏÞ·ÖÀà,ClassPathÕâ¸ö×ֶζ¨ÒåÏÞÖÆ¡£
2.Ö÷¼üCLASSID²»ÊÇ×ÔÔöµÄ£¬Ê¹ÓÃCODESMITHÅúÁ¿Éú³É¶à²ã¼Ü¹¹´úÂëÖлᵼÖ³ö´í¡£
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ArticleClass]') and OBJECTPROPERTY(id, N'IsUse ......

SQLµ±Ç°ÈÕÆÚ»ñÈ¡¼¼ÇÉ

SQLµ±Ç°ÈÕÆÚ»ñÈ¡¼¼ÇÉ
select   getdate()   //2003-11-07   17:21:08.597    
  select   convert(varchar(10),   getdate(),120)   //2003-11-07  
  select   convert(char(8),getdate(),112)  ......

NHibernateÖ´ÐÐԭʼSQL´úÂëµÄ·½·¨Ð¡½á

ÔÚʹÓÃNHibernate¹ý³ÌÖо­³£»áʹÓõ½¸´ÔÓµÄsql²éѯ£¬µ«ÊÇʹÓÃhqlÓֱȽÏÂé·³µÄÇé¿öÏ£¬ÎÒÃÇÍùÍù¶¼»áÏëµ½²ÉÓÃԭʼµÄsqlÀ´Ö´ÐС£µ«ÊÇÈçºÎÀûÓÃNHibernateÀ´Ö´ÐÐsqlÄØ£¿ÎÊÌâÀ´ÁË£¬ÔÚNHibernateÖÐÒ²ÓÐAdoTemplateµÄ·½·¨¿ÉÒÔÖ´ÐÐsqlµÄ£¬µ«ÊÇÕâÀïÒª½éÉܵÄÊÇÁíÍâÒ»ÖÖ·½·¨£ºCreateSQLQuery¡£ÒÔϲ¿·ÖÀý×ÓÔ´×ÔÓÚÍøÂç¡£
ʵÀýÒ»£¨Ô´×ÔÓÚ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ