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

SQL Server Êý¾Ý¿â¹ÜÀí³£ÓõÄSQLºÍT SQLÓï¾ä

SQL Server Êý¾Ý¿â¹ÜÀí³£ÓõÄSQLºÍT-SQLÓï¾ä
1. ²é¿´Êý¾Ý¿âµÄ°æ±¾
select @@version
2. ²é¿´Êý¾Ý¿âËùÔÚ»úÆ÷²Ù×÷ϵͳ²ÎÊý
exec master..xp_msver
3. ²é¿´Êý¾Ý¿âÆô¶¯µÄ²ÎÊý
sp_configure
4. ²é¿´Êý¾Ý¿âÆô¶¯Ê±¼ä
select convert(varchar(30),login_time,120) from master..sysprocesses where spid=1
²é¿´Êý¾Ý¿â·þÎñÆ÷ÃûºÍʵÀýÃû
print 'Server Name: ' + convert(varchar(30),@@SERVERNAME)
print 'Instance: ' + convert(varchar(30),@@SERVICENAME)
5. ²é¿´ËùÓÐÊý¾Ý¿âÃû³Æ¼°´óС
sp_helpdb
ÖØÃüÃûÊý¾Ý¿âÓõÄSQL
sp_renamedb 'old_dbname', 'new_dbname'
6. ²é¿´ËùÓÐÊý¾Ý¿âÓû§µÇ¼ÐÅÏ¢
sp_helplogins
²é¿´ËùÓÐÊý¾Ý¿âÓû§ËùÊôµÄ½ÇÉ«ÐÅÏ¢
sp_helpsrvrolemember
ÐÞ¸´Ç¨ÒÆ·þÎñÆ÷ʱ¹ÂÁ¢Óû§Ê±,¿ÉÒÔÓõÄfix_orphan_user½Å±¾»òÕßLoneUser¹ý³Ì
¸ü¸Äij¸öÊý¾Ý¶ÔÏóµÄÓû§ÊôÖ÷
sp_changeobjectowner [@objectname =] 'object', [@newowner =] 'owner'
×¢Òâ: ¸ü¸Ä¶ÔÏóÃûµÄÈÎÒ»²¿·Ö¶¼¿ÉÄÜÆÆ»µ½Å±¾ºÍ´æ´¢¹ý³Ì¡£
°Ñһ̨·þÎñÆ÷ÉϵÄÊý¾Ý¿âÓû§µÇ¼ÐÅÏ¢±¸·Ý³öÀ´¿ÉÒÔÓÃadd_login_to_aserver½Å±¾
7. ²é¿´Á´½Ó·þÎñÆ÷
sp_helplinkedsrvlogin
²é¿´Ô¶¶ËÊý¾Ý¿âÓû§µÇ¼ÐÅÏ¢
sp_helpremotelogin
8.²é¿´Ä³Êý¾Ý¿âÏÂij¸öÊý¾Ý¶ÔÏóµÄ´óС
sp_spaceused @objname
»¹¿ÉÒÔÓÃsp_toptables¹ý³Ì¿´×î´óµÄN(ĬÈÏΪ50)¸ö±í
²é¿´Ä³Êý¾Ý¿âÏÂij¸öÊý¾Ý¶ÔÏóµÄË÷ÒýÐÅÏ¢
sp_helpindex @objname
»¹¿ÉÒÔÓÃSP_NChelpindex¹ý³Ì²é¿´¸üÏêϸµÄË÷ÒýÇé¿ö
SP_NChelpindex @objname
clusteredË÷ÒýÊǰѼǼ°´ÎïÀí˳ÐòÅÅÁеģ¬Ë÷ÒýÕ¼µÄ¿Õ¼ä±È½ÏÉÙ¡£
¶Ô¼üÖµDML²Ù×÷Ê®·ÖƵ·±µÄ±íÎÒ½¨ÒéÓ÷ÇclusteredË÷ÒýºÍÔ¼Êø£¬fillfactor²ÎÊý¶¼ÓÃĬÈÏÖµ¡£
²é¿´Ä³Êý¾Ý¿âÏÂij¸öÊý¾Ý¶ÔÏóµÄµÄÔ¼ÊøÐÅÏ¢
sp_helpconstraint @objname
9.²é¿´Êý¾Ý¿âÀïËùÓеĴ洢¹ý³ÌºÍº¯Êý
use @database_name
sp_stored_procedures
²é¿´´æ´¢¹ý³ÌºÍº¯ÊýµÄÔ´´úÂë
sp_helptext '@procedure_name'
²é¿´°üº¬Ä³¸ö×Ö·û´®@strµÄÊý¾Ý¶ÔÏóÃû³Æ
select distinct object_name(id) from syscomments where text like '%@str%'
´´½¨¼ÓÃܵĴ洢¹ý³Ì»òº¯ÊýÔÚASÇ°Ãæ¼ÓWITH ENCRYPTION²ÎÊý
½âÃܼÓÃܹýµÄ´æ´¢¹ý³ÌºÍº¯Êý¿ÉÒÔÓÃsp_decrypt¹ý³Ì
10.²é¿´Êý¾Ý¿âÀïÓû§ºÍ½ø³ÌµÄÐÅÏ¢
sp_who
²é¿´SQL ServerÊý¾Ý¿âÀïµÄ»î¶¯Óû§ºÍ½ø³ÌµÄÐÅÏ¢
sp_who 'active'
²é¿´SQL ServerÊ


Ïà¹ØÎĵµ£º

sql ÈÕÆÚ¼ÆËã

ÔÚÍøÉÏËÑÁË ºÃ¶à
ÓÐÆ´½Ó×Ö·û´®µÄ£¬²»¹ýÎÒ¾õµÃ ¼ÈÈ» sql ³ýÁË dateTime  Õâ¸öÀàÐÍ ¾Í²»»áÈÃÄã È¥½ØÈ¡×Ö·û´® £¨ÕâÑù¶àÂ鷳ѽ£©
ÓÚÊÇÔÙËÑ  £¬ÕÒµ½Ò»¸ö±È½ÏºÃµÄ  ÏÖÔÚ½éÉÜÒ»ÏÂ
DATEDIFF(DAY,addDate, '2010-04-23') = -1
ʲôÒâ˼ÄØ£¿ÌýÎÒÂýÂý·Ö½â
DATEDIFF  ²»ÓöàÉÙ  º¯ÊýÃû
DAY   ......

¡¾SQL Server ÓÅ»¯ÐÔÄܵļ¸¸ö·½Ãæ¡¿

              SQL Server ÓÅ»¯ÐÔÄܵļ¸¸ö·½Ãæ
 
(Ò»).Êý¾Ý¿âµÄÉè¼Æ
   ¿ÉÒԲο´×î½üÂÛ̳ÉϳöÏÖÒ»¸ö¾«»ªÌûhttp://topic.csdn.net/u/20100415/10/a377d835-acbd-4815-8bcb-b367f88ac8b5.html?92227
   Êý¾Ý¿âÉè¼Æ°üº¬ÎïÀíÉè ......

sql²Ù×÷ÊÖ²á

ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
SQL·ÖÀࣺ 
DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE) 
DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT) 
DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CR ......

½ÌÄãÈçºÎʹÓÃSQL ServerÀ´¹ýÂËÊý¾Ý

¡¡¡¡¹ØϵÐÍÊý¾Ýͨ³£ÒԹ淶»¯ÐÎʽ±£´æ£¬¾ÍÊÇ˵ÄãÓ¦¸Ã¾¡¿ÉÄÜÉÙµØÖظ´Êý¾Ý;ͨ³£Çé¿öÏ£¬±íÓë±íÖ®¼ä½öͨ¹ý¸÷ÖÖ¼üֵʵÏÖ¹ØÁª¡£
¡¡¡¡¹ØϵÐÍÊý¾Ýͨ³£ÒԹ淶»¯ÐÎʽ±£´æ£¬¾ÍÊÇ˵ÄãÓ¦¸Ã¾¡¿ÉÄÜÉÙµØÖظ´Êý¾Ý;ͨ³£Çé¿öÏ£¬±íÓë±íÖ®¼ä½öͨ¹ý¸÷ÖÖ¼üֵʵÏÖ¹ØÁª¡£½øÒ»²½µØ½²£¬¹æ·¶»¯µÄº¬Òå¾ÍÊÇ£ºÄã²»ÄÜÔÚÊý¾Ý¿âÖб£´æ¼ÆËãºóµÄÖµ£¬¶øÄãÖ»ÄÜÔÚ ......

SQL SERVERÐÔÄÜÓÅ»¯×ÛÊö

SQL SERVERÐÔÄÜÓÅ»¯×ÛÊö
--Ô­Öø:Haiwer
 
½üÆÚÒò¹¤×÷ÐèÒª£¬Ï£Íû±È½ÏÈ«ÃæµÄ×ܽáÏÂSQL SERVERÊý¾Ý¿âÐÔÄÜÓÅ»¯Ïà¹ØµÄ×¢ÒâÊÂÏÔÚÍøÉÏËÑË÷ÁËÒ»ÏÂ,·¢ÏֺܶàÎÄÕÂ,ÓеĶ¼ÁгöÁËÉÏ°ÙÌõ,µ«ÊÇ×Ðϸ¿´·¢ÏÖ£¬ÓкܶàËÆÊǶø·Ç»òÕß¹ýʱ(¿ÉÄܶÔSQL SERVER6.5ÒÔÇ°µÄ°æ±¾»òÕßORACLEÊÇÊÊÓõÄ)µÄÐÅÏ¢£¬Ö»ºÃ×Ô¼º¸ù¾ÝÒÔÇ°µÄ¾­ÑéºÍ²âÊÔ½á¹û½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ