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°ïÖú¡£
Ïà¹ØÎĵµ£º
µ±ÎÒÃÇÌá½»Ò»ÌõsqlÓï¾äʱ£¬oracle»á×öÄÄЩ²Ù×÷ÄØ£¿
Oracle»áΪÿ¸öÓû§½ø³Ì·ÖÅäÒ»¸ö·þÎñÆ÷½ø³Ì£ºservice process£¨Êµ¼ÊÇé¿öÓ¦¸ÃÇø·ÖרÓ÷þÎñÆ÷ºÍ¹²Ïí·þÎñÆ÷£©£¬µ±service process½ÓÊÕµ½Óû§½ø³ÌÌá½»µÄsqlÓï¾äʱ£¬·þÎñÆ÷½ø³Ì»á¶ÔsqlÓï¾ä½øÐÐÓï·¨ºÍ´Ê·¨·ÖÎö¡£
Ãû´Ê½âÊÍ£º
Óï·¨·ÖÎö£ºÓï¾ä±¾ÉíÕýÈ·ÐÔ¡£
´Ê·¨·ÖÎö£º¶ÔÕÕÊ ......
SQL Server 2005 ûÓÐSQL Server Management Studio
°²×°visual studio 2005µÄʱºòϵͳҲװÁËSQL 2005¡£Çë×¢Ò⣬Õâʱ°²×°ÉϵÄSQL2005ÊÇExpress°æ±¾µÄ£¬¼È²»ÊÇÆóÒµ°æ£¬Ò²²»ÊÇ¿ª·¢Õß°æ¡£ÕâʱµÄExpress°æÊÇûÓа²×°SQL Server Management Studio µÄ£¬Ö»ÓÐÅäÖù¤¾ß£¬Ò²¾ÍÊÇ˵ÄãÔÚ¿ªÊ¼²Ëµ¥Ö»¿´µÃµ½ÅäÖù¤¾ß¡£
Õâʱ ......
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
¡¡¡¡SQL·ÖÀࣺ
¡¡¡¡DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
¡¡¡¡DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
¡¡¡¡DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
¡¡¡¡Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
¡¡¡¡1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
......
ÔÚ¿ª·¢²»ÂÛÊÇWEB»¹ÊÇWinform³ÌÐòÖУ¬Êý¾Ý·ÖÒ³ÊǾ³£Óöµ½µÄÎÊÌ⣬ҪÊÇÔÚ´úÂëÖÐʵÏִ˹ý³Ì£¬ÏÔÈ»½µµÍÁË·þÎñÆ÷µÄЧÂÊ£¬¿ÉÒÔʹÓÃÒÔÏ´洢¹ý³ÌÀ´ÊµÏÖ¡£
CREATE PROCEDURE pagination
@tblName varchar(255), -- ±íÃû
@strGetFields varchar(1000) = '*', -- ÐèÒª·µ»ØµÄÁÐ
@fldName varchar(255)= ......
»Ö¸´Ä£Ê½£¨Recovery Model£©Ö¼ÔÚ¿ØÖÆÊÂÎñÈÕ־ά»¤¡£»Ö¸´Ä£Ê½ËµÃ÷Á˹¤×÷¶ªÊ§µÄ·çÏÕ£¬ÄÜ·ñ»Ö¸´µ½Ê±µã£¿
SQL ServerÊý¾Ý¿âÓÐÈýÖÖ»Ö¸´Ä£Ê½£º¼òµ¥»Ö¸´Ä£Ê½¡¢ÍêÕû»Ö¸´Ä£Ê½ºÍ´óÈÝÁ¿ÈÕÖ¾»Ö¸´Ä£Ê½¡£
Ïà¶ÔÓÚ¼òµ¥»Ö¸´Ä£Ê½¶øÑÔ£¬ÍêÕû»Ö¸´Ä£Ê½ºÍ´óÈÝÁ¿ÈÕÖ¾»Ö¸´Ä£Ê½ÌṩÁ˸üÇ¿µÄÊý¾Ý±£»¤¹¦ÄÜ¡£ÕâЩ»Ö¸´Ä£Ê½¶¼ÊÇ»ùÓÚ±¸·ÝÊÂÎñÈÕÖ ......