Sql server 2005 µÇ¼ɨä
1. ÔÚʹÓÃsql server ֮ǰÄØ£¬×îºÃ¶ÔÆä½øÐÐÅäÖÃ
(1) ÅäÖù¤¾ß->Sql server configuration Manager
Ñ¡ÔñSql server 2005Íø·ÅäÖà Ï嵀 MSSQLSERVERµÄÐÒé ÔÚ´°¿ÚÓұߵÄ
TCP/IPÐÒéÓÒ¼üÊôÐÔ£¬ÅäÖÃÈçÏÂ
IP1ÖеÄIPµØַΪ±¾µØIP¡£TCP¶¯Ì¬¶Ë¿ÚΪ0±íʾʹÓö¯Ì¬¶Ë¿Ú¡£
(2)½«ÐÒéÆô¶¯
(3)ÖØÆô·þÎñ£¬ÓÉÓÚSql server 2005·þÎñ½Ï¶à£¬ËùÒÔÒ»¶¨Òª¿´ºÃ£¬ÖØÆô·þÎñµÄÊÇ
SQL Server(MSSQLSERVER)
2. 怬SQL Server
SQL ServerµÄµÇ¼·ÖΪ£ºwindowsÉí·ÝÑéÖ¤ºÍSQL ServerÉí·ÝÑéÖ¤Á½ÖÖ¡£
windowsÉí·ÝÑéÖ¤£º±È½ÏÈÝÒ×ֻҪѡÔñwindowsÉí·ÝÑéÖ¤£¬SQL Server¾Í»á¸ù¾ÝװϵͳʱµÄÓû§ÃûºÍÃÜÂë×Ô¶¯µÇ¼£¬¶ø²»ÐèÒª×Ô¼ºÊÖ¶¯ÊäÈëwindowsµÄÓû§ÃûºÍÃÜÂë¡£
ËùÒÔ¼´Ê¹Äã²»ÖªµÀwindowsµÄÓû§ÃûºÍÃÜÂëÒ²¿ÉÒԵǼSQL Server
µ«Êǵ±ÄãÓÃJDBCÁ¬½ÓSQL ServerµÄʱºò£¬ÒòΪÄã²»ÖªµÀwindowsµÄÓû§ÃûºÍÃÜÂëÄã¾ÍÎÞ·¨Ð´Á¬½Ó×Ö·û´®ÖеÄuserºÍpassword
SQL ServerÉí·ÝÑéÖ¤£ºÓÐÒ»¸öSQL Server×Ô´øµÄµÇ¼ÃûSa£¬ÃÜÂëΪ°²×°SQL ServerʱÉèÖõÄÃÜÂë¡£ÐèÒªÊÖ¶¯ÊäÈëSaµÄÃÜÂë¡£
ËùÒÔÈç¹û²»ÖªµÀSaµÄÃÜÂ룬ҲÎÞ·¨½øÐÐJDBCÁ¬½Ó
ÄÇôµ±Äã¼È²»ÖªµÀ×Ô¼º×°ÏµÍ³Ê±µÄÓû§ÃûºÍÃÜÂëÊǶàÉÙ£¬Ò²²»ÖªµÀ°²×°SQL ServerÉèÖõÄSaÃÜÂëΪ¶àÉÙʱ£¬¾Í¿ÉÒÔÓÃÏÂÊö·½·¨´´½¨ÐµÄSQL ServerÉí·ÝÑéÖ¤µÄµÇ¼ÃûºÍÃÜÂë½øÐÐJDBCÁ¬½Ó
£¨1£©Ê¹ÓÃwindowsÉí·ÝÑéÖ¤µÇ¼£¬ÔÚ°²È«ÐÔÏÂÃæµÄµÇ¼Ãû£¬ÓÒ¼üµã»÷н¨µÇ¼Ãû
ÊäÈëµÇ¼Ãû£¬Ñ¡ÔñSQL ServerÉí·ÝÑéÖ¤£¬ÊäÈëÃÜÂ룬½«Óû§ÔÚÏ´εǼʱ±ØÐë¸ü¸ÄÃÜÂëÇ°ÃæµÄ¶ÔºÅÈ¥µô¡£
Ñ¡Ôñ×ó²àµÄÓû§Ó³É䣬¹´Ñ¡ÒªÓ³ÉäµÄÊý¾Ý¿â¡£ÔÚÏÂÃæµÄÊý¾Ý¿â½ÇÉ«³ÉÔ±Éí·ÝÖУ¬¹´Ñ¡db_ownerºÍpublic
Ñ¡Ôñ×ó²àµÄ״̬£¬¹´Ñ¡ÊÚȨºÍÆôÓá£È·¶¨
£¨2£©ÓÒ¼ü·þÎñÆ÷ £¬Ñ¡ÔñÊôÐÔ£¬×ó²àµã»÷°²È«ÐÔ£¬¹´Ñ¡SQL serverºÍWindowsÉí·ÝÑé֤ģʽ
ºÃÀ²£¡ÏÖÔھͿÉÒÔʹÓÃÓû§Ãûzsh¼°Æä
Ïà¹ØÎĵµ£º
Sql Server ÖÐÒ»¸ö·Ç³£Ç¿´óµÄÈÕÆÚ¸ñʽ»¯º¯Êý
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06
Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16
Select CONVERT(varchar(100), GETDATE(), 3): 16/05/06
Select CONVERT(varchar(100), GE ......
exists £¨sql ·µ»Ø½á¹û¼¯ÎªÕ棩
not exists (sql ²»·µ»Ø½á¹û¼¯ÎªÕ棩
ÈçÏ£º
±íA
ID NAME
1 A1
2 A2
3 A3
±íB
ID AID NAME
1 1 B1
2 2 B2
3 2 B3
±íAºÍ±íBÊÇ£±¶Ô¶àµÄ¹Øϵ A.ID => B.AID
......
ÏÖÔÚÓÃMSSQLµÄµØ·½Ì«¶àÁË£¬Óкܶà×ö¼¼ÊõµÄ¸öÈ˵çÄÔÉÏÒ²°²×°SQLרҵ°æ£¬ÒòΪËüÓõĶ࣬µ«ÓõÄÈ˶¼ÖªµÀ£¬SQLÓиö³¬¼¶Óû§sa£¬´ËÓû§Ä¬ÈÏÇé¿öÏ£¬ËüÖ¸Åɸø¹Ì¶¨·þÎñÆ÷½ÇÉ« sysadmin£¬²¢²»ÄܽøÐиü¸Ä¡£Ò»°ã¶®µã°²È«ÎÊÌâµÄ¼¼ÊõÈËÔ±¶¼»á°ÑÕâ¸öÃÜÂëÐ޸ĵô£¬µ«ÐÞ¸ÄÔÙ¸´ÔÓµÄÃÜÂ붼²»ÊǾø¶Ô°²È«µÄ£¬Ò»Ð©±©Á¦ÆƽâÈí¼þ£¬²ËÄñ¶¼»áÓá£
ÄÇ ......
ϵͳº¯Êý
1.case when ... then ..else ..end(ÓÃÓÚ¶ÔÌõ¼þ½øÐвâÊÔ)
e.Select id,case when name='deepwishly' then 'ÀÏ´ó' else 'ÆäËû' end as Type
ÏÔʾ id type
1 ÀÏ´ó
2.cast()/convert() Ç°Õß¾ßÓÐANSI SQL-92¼æÈÝÐÔ£¬ºóÕß¹¦ÄܸüÇ ......
³£¼û²¢·¢²¢·¢Ò»ÖÂÐÔÎÊÌâ°üÀ¨£º¶ªÊ§µÄÐ޸ġ¢²»¿ÉÖظ´¶Á¡¢¶ÁÔàÊý¾Ý¡¢»ÃÓ°¶Á£¨»ÃÓ°¶ÁÔÚһЩ×ÊÁÏÖÐÍùÍùÓë²»¿ÉÖظ´¶Á¹éΪһÀࣩ¡£
2.2.1.1 ¶ªÊ§ÐÞ¸Ä
ÏÂÃæÎÒÃÇÏÈÀ´¿´Ò»¸öÀý×Ó£¬ËµÃ÷²¢·¢²Ù×÷´øÀ´µÄÊý¾ÝµÄ²»Ò»ÖÂÐÔÎÊÌâ¡£
¿¼ÂÇ·É»ú¶©Æ±ÏµÍ³ÖеÄÒ»¸ö»î¶¯ÐòÁÐ:
¼×ÊÛƱµã£¨¼×ÊÂÎñ£©¶Á³öijº½°àµÄ»úƱÓà¶îA,ÉèA=16.
ÒÒÊÛƱµã£¨ÒÒÊÂÎñ ......