Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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²éѯ·ÖÎöÆ÷²Ù×ÝExcel¼°µ¼Èëµ¼³öÊý¾Ý

SQL SERVER ºÍEXCELµÄÊý¾Ýµ¼Èëµ¼³ö
ͨ³£µÄ·½·¨ÊÇʹÓÃͼÐνçÃæµÄdts¹¤¾ß£¬µ«·¢¾õÓÐЩʹÓÃÃüÁîÐнçÃæµÄ·½Ê½¸ü¼òµ¥
1¡¢ÔÚSQL SERVERÀï²éѯExcelÊý¾Ý:
-- ======================================================
SELECT *
from OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\book1.xls";Use ......

sql Óï¾äʹÓÃ

SQLÓï¾ä(Ôö¡¢É¾¡¢¸Ä¡¢²é)
¡¡¡¡
¡¡¡¡Ò»¡¢Ôö£ºÓÐ4ÖÖ·½·¨
¡¡¡¡
¡¡¡¡1.ʹÓÃinsert²åÈëµ¥ÐÐÊý¾Ý£º
¡¡¡¡
¡¡¡¡Óï·¨£ºinsert [into] <±íÃû> [ÁÐÃû] values <ÁÐÖµ>
¡¡¡¡
¡¡¡¡Àý£ºinsert into Strdents (ÐÕÃû,ÐÔ±ð,³öÉúÈÕÆÚ) values ('¿ªÐÄÅóÅó','ÄÐ','1980/6/15')
¡¡¡¡
¡¡¡¡×¢Ò⣺into¿ÉÒÔÊ¡ÂÔ£»ÁÐÃûÁÐÖµÓöºº ......

Êý¾Ý¿âÉè¼Æ£¨6£©_ÃüÃû¼°±àÂë¹æ·¶_SQL SERVER

Ò»¡¢×ÛÊö
ÃüÃûºÍ±àÂë¹ý³ÌÖУ¬¶¨ÒåÓÐÒâÒåµÄÃû³Æ£¬ÒÔÒ×ÓÚÀí½â¡¢·½±ãÊéдΪԭÔò¡£
£¨1£©±ÜÃâʹÓÃÖÐÎÄ£¬¾¡Á¿Ê¹ÓÃÈ«Æ´Òô»òÈ«Ó¢ÎÄ£¬ÒÔ·½±ã¹ú¼Ê»¯£»
£¨2£©±ÜÃâÆ´ÒôºÍÓ¢ÎĵÄÖÐÎ÷ºÏèµ£¬È磺CAOZUO_TIME£»
£¨3£©±ÜÃâÔÚÃüÃûÖаüÀ¨¿Õ¸ñ¼°ÌØÊâ×Ö·û£»
£¨4£©±ÜÃâʹÓñ£Áô×Ö£»
£¨5£©±ÜÃâÃû³ÆÌ«³¤£¬×¢ÒâËõдµÄʹÓã¬Ëõд¹æÔòΪµ¥´ÊÇ°4¸ ......

sql ÈÕÆÚ¼ÆËã

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

SQL Server2005Á¬½ÓExcel¡¢Access

ת×Ô£ºhttp://blog.csdn.net/oceanrain/archive/2006/09/26/1289188.aspx
±¾ÎÄÖ÷Òª½éÉÜͨ¹ýSQL Server2005Á¬½ÓExcelºÍAccess,È»ºó·ÃÎÊExcel¹¤×÷²¾ÖеÄÄÚÈݼ°Access±¾µØÊý¾Ý¿âÖеıíÄÚÈݵķ½·¨:
Ò».SQL Server2005ÈçºÎ·ÃÎÊExcelÎļþÖеÄÊý¾Ý£¿
 1.ÔËÐÐ"¿ªÊ¼ \ ³ÌÐò \ Microsoft SQL Server 2005 \ SQL Server Manage ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ