Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : sql

QTPÊý¾Ý¿â¼ì²éµãÊÖ¶¯SQLд·¨

Ò»¡¢SQL Server¸ñʽ(±¾µØÎÞÐè°²×°SQL Server)
connectionstring(Á¬½Ó×Ö·û´®):
1.±¾µØûÓд´½¨Êý¾ÝÔ´µÄ·½Ê½
DRIVER=SQL Server;SERVER=Êý¾Ý¿âIPµØÖ·;UID=Óû§Ãû;PWD=ÃÜÂë;APP=Microsoft Office 2003;WSID=±¾µØÖ÷»úÃû;DATABASE=Êý¾Ý¿âÃû
ʵÀý£º
DRIVER=SQL Server;SERVER=10.160.11.10;UID=sa;PWD=sa;APP=Microsoft Office 2003;WSID=RJHLJUN;DATABASE=dcwork
2.±¾µØÒÑ´´½¨Êý¾ÝÔ´µÄ·½Ê½
DSN=Êý¾ÝÔ´Ãû³Æ;UID=Óû§Ãû;PWD=ÃÜÂë;APP=Microsoft Office 2003;WSID=Êý¾Ý¿âµÄÖ÷»úÃû;DATABASE=Êý¾Ý¿âÃû
ʵÀý£º
DSN=LocalServer;UID=sa;PWD=sa;APP=Microsoft Office 2003;WSID=RJDCWORKTEST;DATABASE=dcwork
3.SQLÓï¾äʵÀý(´ÓÊý¾Ý¿â±íHR_LANGUAGE_TYPEÖУ¬²éѯ×Ö¶ÎÓïÑÔÃû³ÆLANGUAGE_NAME£¬Ìõ¼þÓïÑÔÃû³Æ£½ÖÐÎÄ£¬°´ÓïÑÔÃû³ÆÉýÐòÅÅÐò½á¹û)
source(SQLÓï¾ä):
SELECT
HR_LANGUAGE_TYPE.LANGUAGE_NAME  from dcwork.dbo.HR_LANGUAGE_TYPE
HR_LANGUAGE_TYPE  WHERE (HR_LANGUAGE_TYPE.LANGUAGE_NAME='ÖÐÎÄ')  ORDER BY
HR_LANGUAGE_TYPE.LANGUAGE_NAME
¶þ¡¢DB2¸ñʽ£º(±¾µØÖÁÉÙ°²×°DB2 Run-Time Client Lite)
connectionstring(Á¬½Ó×Ö·û´®):
1.±¾ ......

×Ô¶¯±¸·ÝSQL2000/MysqlµÄÅú´¦ÀíÎļþ


@echo off
C:
CD "C:\Program Files\WinRAR"
net stop MSSQLserver
winrar.exe a -ag"-[YYYY-MM-DD-HH-MM-SS]" -k -r -s
-ibck -inul "E:\SQL2000±¸·ÝÉú³ÉµÄÎļþ.rar" "E:\SQL2000ËùÔÚÊý¾Ý¿âµÄDataĿ¼µÄλÖÃ\*.*"
net
start MSSQLserver
net stop Mysql
winrar.exe a -ag"-[YYYY-MM-DD-HH-MM-SS]" -k -r -s -ibck
-inul "E:\MYSQL±¸·ÝÉú³ÉµÄÎļþ.rar" "E:\MysqlËùÔÚÊý¾Ý¿âµÄDataĿ¼µÄλÖÃ\*.*"
net start
Mysql
½«ÉÏÃæµÄÎļþ±£´æΪ£ºbackupsql.bat
½«ÀïÃæµÄ
"E:\SQL2000ËùÔÚÊý¾Ý¿âµÄDataĿ¼µÄλÖÃ\*.*"
¸Ä³ÉÄú×Ô¼ºµÄSQL2000µÄdataĿ¼,Èç
"E:\Program Files\Microsoft SQL Server\MSSQL\Data\*.*"
ÔÙ½«ÀïÃæµÄ
"E:\MysqlËùÔÚÊý¾Ý¿âµÄDataĿ¼µÄλÖÃ\*.*"
¸Ä³ÉÄú×Ô¼ºµÄMysqlµÄdataĿ¼,Èç:
"E:\Program Files\MySQL\MySQL Server 5.0\data\*.*"
±£´æºó,
Äú¾Í¿ÉÒÔÔÚ·þÎñÆ÷ÉϵĿØÖÆÃæ°å,¼Æ»®ÈÎÎñÖÐ,
Ìí¼ÓÒ»¸ö¼Æ»®ÈÎÎñ,µ÷ÓÃÕâ¸öbackupsql.batÀ´ÔËÐоͿÉÒÔʵÏÖ¶¨Ê±±¸·Ý.±¸·ÝÉú³ÉµÄÎļþĬÈϱ£´æÔÚEÅÌ,Äú¿ÉÒÔͨ¹ýÐÞ¸Äbackupsql.batÀ´ÐÞ¸ÄλÖÃ.
......

×Ô¶¯±¸·ÝSQL2000/MysqlµÄÅú´¦ÀíÎļþ


@echo off
C:
CD "C:\Program Files\WinRAR"
net stop MSSQLserver
winrar.exe a -ag"-[YYYY-MM-DD-HH-MM-SS]" -k -r -s
-ibck -inul "E:\SQL2000±¸·ÝÉú³ÉµÄÎļþ.rar" "E:\SQL2000ËùÔÚÊý¾Ý¿âµÄDataĿ¼µÄλÖÃ\*.*"
net
start MSSQLserver
net stop Mysql
winrar.exe a -ag"-[YYYY-MM-DD-HH-MM-SS]" -k -r -s -ibck
-inul "E:\MYSQL±¸·ÝÉú³ÉµÄÎļþ.rar" "E:\MysqlËùÔÚÊý¾Ý¿âµÄDataĿ¼µÄλÖÃ\*.*"
net start
Mysql
½«ÉÏÃæµÄÎļþ±£´æΪ£ºbackupsql.bat
½«ÀïÃæµÄ
"E:\SQL2000ËùÔÚÊý¾Ý¿âµÄDataĿ¼µÄλÖÃ\*.*"
¸Ä³ÉÄú×Ô¼ºµÄSQL2000µÄdataĿ¼,Èç
"E:\Program Files\Microsoft SQL Server\MSSQL\Data\*.*"
ÔÙ½«ÀïÃæµÄ
"E:\MysqlËùÔÚÊý¾Ý¿âµÄDataĿ¼µÄλÖÃ\*.*"
¸Ä³ÉÄú×Ô¼ºµÄMysqlµÄdataĿ¼,Èç:
"E:\Program Files\MySQL\MySQL Server 5.0\data\*.*"
±£´æºó,
Äú¾Í¿ÉÒÔÔÚ·þÎñÆ÷ÉϵĿØÖÆÃæ°å,¼Æ»®ÈÎÎñÖÐ,
Ìí¼ÓÒ»¸ö¼Æ»®ÈÎÎñ,µ÷ÓÃÕâ¸öbackupsql.batÀ´ÔËÐоͿÉÒÔʵÏÖ¶¨Ê±±¸·Ý.±¸·ÝÉú³ÉµÄÎļþĬÈϱ£´æÔÚEÅÌ,Äú¿ÉÒÔͨ¹ýÐÞ¸Äbackupsql.batÀ´ÐÞ¸ÄλÖÃ.
......

SQL ServerΨһԼÊøµÄʹÓÃ

    ±í½á¹¹ÈçÏÂ:
   id int 4
   EntryID int 4
   BlogID int 4
   ÏÖÔÚÒªÇóÔÚ²åÈëʱ£¬²»ÔÊÐí²åÈëEntryIDÓëBlogID¶¼ÏàͬµÄ¼Ç¼£¬¼´±íÖв»ÔÊÐíÈÎÒâÁ½Ìõ¼Ç¼µÄEntryIDÓëBlogID¶¼Ïàͬ£¬EntryIDÓëBlogID¹¹³É¼Ç¼µÄΨһ±êʶ¡£
   ÒÔÇ°ÎҵĴ¦Àí·½·¨Ê±£¬ÔÚ²åÈë֮ǰ£¬Í¨¹ýselect¼ì²éÊÇ·ñ´æÔÚÏàͬµÄ¼Ç¼¡£
ÏÖÔÚÎÒ²ÉÓÃSQL ServerΨһԼÊøÀ´ÊµÏÖ£¬¼òµ¥·½±ã£¬Ð§ÂÊÓָߡ£ÊµÏÖ·½·¨ÊÇ£º
1¡¢ÔÚÊý¾Ý¿â¹ØϵͼÖÐÓÒ»÷½«°üº¬Ô¼ÊøµÄ±í£¬È»ºó´Ó¿ì½Ý²Ëµ¥ÖÐÑ¡Ôñ"ÊôÐÔ"ÃüÁî¡£
-»ò-
Ϊ½«°üº¬Ô¼ÊøµÄ±í´ò¿ª±íÉè¼ÆÆ÷£¬ÔÚ±íÉè¼ÆÆ÷ÖÐÓÒ»÷£¬È»ºó´Ó¿ì½Ý²Ëµ¥ÖÐÑ¡Ôñ"ÊôÐÔ"ÃüÁî¡£
2¡¢Ñ¡Ôñ"Ë÷Òý/¼ü"Ñ¡Ï¡£
3¡¢Ñ¡Ôñ"н¨"ÃüÁϵͳ·ÖÅäµÄÃû³Æ³öÏÖÔÚ"Ë÷ÒýÃû"¿òÖС£
4¡¢ÔÚ"ÁÐÃû"ÏÂÕ¹¿ªÁеÄÁÐ±í£¬Ñ¡ÔñÒª½«Ô¼Êø¸½¼Óµ½µÄÁÐ(ÔÚÕâÀïÎÒÃÇÑ¡ÔñÁÐEntryID¡¢BlogID)¡£
5¡¢Ñ¡Ôñ"´´½¨ UNIQUE"¸´Ñ¡¿ò¡£
6¡¢Ñ¡Ôñ"Ô¼Êø"Ñ¡Ïî¡£
µ±±£´æ±í»ò¹Øϵͼʱ£¬Î¨Ò»Ô¼Êø¼´´´½¨ÔÚÊý¾Ý¿âÖС£ ÏÖÔÚÎÒÃÇÔÙ½øÐвåÈ룬¾Í³öÏÖ´íÎó"Î¥·´ÁË UNIQUE KEY Ô¼Êø..."¡£
ÎÒÃÇÔÚ³ÌÐòÖⶻñÕâ¸ö´íÎ󣬾ÍÖªµ ......

SQL Server Ë÷Òý»ù´¡ÖªÊ¶(4)

ÓÐЩÈË¿ÉÄܶÔÖ÷¼üºÍ¾Û¼¯Ë÷ÒýÓÐËù»ìÏý£¬ÆäʵÕâÁ½¸öÊDz»Í¬µÄ¸ÅÄÏÂÃæÊÇÒ»¸ö¼òµ¥µÄÃèÊö¡£²»Ïë¿´ÈÆ¿ÚÎÄ×ÖÕߣ¬Ö±½Ó¿´Á½ÕßµÄ¶Ô±È±í¡£ÓÈÆäÊÇ×îºóÒ»ÏîµÄ±È½Ï¡£
Ö÷¼ü£¨PRIMARY KEY £©
À´×ÔMSDNµÄÃèÊö£º
±íͨ³£¾ßÓаüº¬Î¨Ò»±êʶ±íÖÐÿһÐеÄÖµµÄÒ»ÁлòÒ»×éÁС£ÕâÑùµÄÒ»Áлò¶àÁгÆΪ±íµÄÖ÷¼ü (PK)£¬ÓÃÓÚÇ¿ÖƱíµÄʵÌåÍêÕûÐÔ¡£ÔÚ´´½¨»òÐ޸ıíʱ£¬Äú¿ÉÒÔͨ¹ý¶¨Òå PRIMARY KEY Ô¼ÊøÀ´´´½¨Ö÷¼ü¡£
Ò»¸ö±íÖ»ÄÜÓÐÒ»¸ö PRIMARY KEY Ô¼Êø£¬²¢ÇÒ PRIMARY KEY Ô¼ÊøÖеÄÁв»ÄܽÓÊÜ¿ÕÖµ¡£ÓÉÓÚ PRIMARY KEY Ô¼Êø¿É±£Ö¤Êý¾ÝµÄΨһÐÔ£¬Òò´Ë¾­³£¶Ô±êʶÁж¨ÒåÕâÖÖÔ¼Êø¡£
Èç¹ûΪ±íÖ¸¶¨ÁË PRIMARY KEY Ô¼Êø£¬Ôò SQL Server 2005 Êý¾Ý¿âÒýÇæ ½«Í¨¹ýΪÖ÷¼üÁд´½¨Î¨Ò»Ë÷ÒýÀ´Ç¿ÖÆÊý¾ÝµÄΨһÐÔ¡£µ±ÔÚ²éѯÖÐʹÓÃÖ÷¼üʱ£¬´ËË÷Òý»¹¿ÉÓÃÀ´¶ÔÊý¾Ý½øÐпìËÙ·ÃÎÊ¡£Òò´Ë£¬ËùÑ¡µÄÖ÷¼ü±ØÐë×ñÊØ´´½¨Î¨Ò»Ë÷ÒýµÄ¹æÔò¡£
´´½¨Ö÷¼üʱ£¬Êý¾Ý¿âÒýÇæ »á×Ô¶¯´´½¨Î¨Ò»µÄË÷ÒýÀ´Ç¿ÖÆʵʩ PRIMARY KEY Ô¼ÊøµÄΨһÐÔÒªÇó¡£Èç¹û±íÖв»´æÔÚ¾Û¼¯Ë÷Òý»òδÏÔʽָ¶¨·Ç¾Û¼¯Ë÷Òý£¬Ôò½«´´½¨Î¨Ò»µÄ¾Û¼¯Ë÷ÒýÒÔÇ¿ÖÆʵʩ PRIMARY KEY Ô¼Êø¡£
¾Û¼¯Ë÷Òý
¾Û¼¯Ë÷Òý»ùÓÚÊý¾ÝÐеļüÖµÔÚ±íÄÚÅÅÐòºÍ´æ´¢ÕâЩÊý¾ÝÐС£Ã¿¸ö±íÖ»ÄÜÓÐÒ»¸ö¾Û¼¯Ë÷Òý£¬ÒòΪÊý ......

³£Óà SQL Óï¾ä´óÈ«

sqlÓï¾ä´óÈ«:³£Óà SQL Óï¾ä´óÈ«
¡¡¡¡Óï ¾ä ¹¦ ÄÜ
¡¡¡¡--Êý¾Ý²Ù×÷
¡¡¡¡SELECT --´ÓÊý¾Ý¿â±íÖмìË÷Êý¾ÝÐкÍÁÐ
¡¡¡¡INSERT --ÏòÊý¾Ý¿â±íÌí¼ÓÐÂÊý¾ÝÐÐ
¡¡¡¡DELETE --´ÓÊý¾Ý¿â±íÖÐɾ³ýÊý¾ÝÐÐ
¡¡¡¡UPDATE --¸üÐÂÊý¾Ý¿â±íÖеÄÊý¾Ý
¡¡¡¡--Êý¾Ý¶¨Òå
¡¡¡¡CREATE TABLE --´´½¨Ò»¸öÊý¾Ý¿â±í
¡¡¡¡DROP TABLE --´ÓÊý¾Ý¿âÖÐɾ³ý±í
¡¡¡¡ALTER TABLE --ÐÞ¸ÄÊý¾Ý¿â±í½á¹¹
¡¡¡¡CREATE VIEW --´´½¨Ò»¸öÊÓͼ
¡¡¡¡DROP VIEW --´ÓÊý¾Ý¿âÖÐɾ³ýÊÓͼ
¡¡¡¡CREATE INDEX --ΪÊý¾Ý¿â±í´´½¨Ò»¸öË÷Òý
¡¡¡¡DROP INDEX --´ÓÊý¾Ý¿âÖÐɾ³ýË÷Òý
¡¡¡¡CREATE PROCEDURE --´´½¨Ò»¸ö´æ´¢¹ý³Ì
¡¡¡¡DROP PROCEDURE --´ÓÊý¾Ý¿âÖÐɾ³ý´æ´¢¹ý³Ì
¡¡¡¡CREATE TRIGGER --´´½¨Ò»¸ö´¥·¢Æ÷
¡¡¡¡DROP TRIGGER --´ÓÊý¾Ý¿âÖÐɾ³ý´¥·¢Æ÷
¡¡¡¡CREATE SCHEMA --ÏòÊý¾Ý¿âÌí¼ÓÒ»¸öÐÂģʽ
¡¡¡¡DROP SCHEMA --´ÓÊý¾Ý¿âÖÐɾ³ýÒ»¸öģʽ
¡¡¡¡CREATE DOMAIN --´´½¨Ò»¸öÊý¾ÝÖµÓò
¡¡¡¡ALTER DOMAIN --¸Ä±äÓò¶¨Òå
¡¡¡¡DROP DOMAIN --´ÓÊý¾Ý¿âÖÐɾ³ýÒ»¸öÓò ......

ÔÚsql server 2005À¸ù¾ÝÊý¾Ý¿âÐÔÄܶ¯Ì¬¹¹½¨Ë÷Òý¡£

ÔÚsql server 2005À¸ù¾ÝÊý¾Ý¿âÐÔÄܶ¯Ì¬¹¹½¨Ë÷Òý¡£
Êý¾Ý¿âÉè¼ÆºÃºó£¬ÏµÍ³ÉÏÏßÔ˶¯Ò»¸öÖÜÆÚºó£¬Êý¾Ý¿âÐÔÄÜÆ¿¾±Í»ÏÖ³öÀ´£¬Õâ¸öʱ¼ä£¬ÐèÒªÒ»ÖÖ¸ù¾ÝÐÔÄÜ£¬À´¶¯Ì¬¹¹½¨Ë÷Òý£¬Ìá¸ß²éѯЧÂÊ¡£
    --¹ý³ÌÓÅ»¯SQL
                    , avg_user_impact
                    , [EqualityUsage] = equality_columns
                    , [Include Cloumns] = included_columns
                    INNER JOIN    sys.dm_db_missing_index_group_stats s
                    INNER JOIN    sys.dm_db_missing_index_details d
                 &n ......
×ܼǼÊý:4346; ×ÜÒ³Êý:725; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [676] [677] [678] [679] 680 [681] [682] [683] [684] [685]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ