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

¹ØÓÚSQL ServerµÄÓÅ»¯

ÈçºÎÓÅ»¯SQL Server
1¡¢  ÓóÌÐòÖУ¬±£Ö¤ÔÚʵÏÖ¹¦ÄܵĻù´¡ÉÏ£¬¾¡Á¿¼õÉÙ¶ÔÊý¾Ý¿âµÄ·ÃÎÊ´ÎÊý£»Í¨¹ýËÑË÷²ÎÊý£¬¾¡Á¿¼õÉÙ¶Ô±íµÄ·ÃÎÊÐÐÊý,×îС»¯½á¹û¼¯£¬´Ó¶ø¼õÇáÍøÂ縺µ££»Äܹ»·Ö¿ªµÄ ²Ù×÷¾¡Á¿·Ö¿ª´¦Àí£¬Ìá¸ßÿ´ÎµÄÏìÓ¦Ëٶȣ»ÔÚÊý¾Ý´°¿ÚʹÓÃSQLʱ£¬¾¡Á¿°ÑʹÓõÄË÷Òý·ÅÔÚÑ¡ÔñµÄÊ×ÁУ»Ëã·¨µÄ½á¹¹¾¡Á¿¼òµ¥£»ÔÚ²éѯʱ£¬²»Òª¹ý¶àµØʹÓÃͨÅä·û ÈçSELECT * from T1Óï¾ä£¬ÒªÓõ½¼¸ÁоÍÑ¡Ôñ¼¸ÁÐÈ磺SELECT COL1,COL2 from T1£»ÔÚ¿ÉÄܵÄÇé¿öϾ¡Á¿ÏÞÖƾ¡Á¿½á¹û¼¯ÐÐÊýÈ磺SELECT TOP 300 COL1,COL2,COL3 from T1,ÒòΪijЩÇé¿öÏÂÓû§ÊDz»ÐèÒªÄÇô¶àµÄÊý¾ÝµÄ¡£²»ÒªÔÚÓ¦ÓÃÖÐʹÓÃÊý¾Ý¿âÓα꣬ÓαêÊǷdz£ÓÐÓõŤ¾ß£¬µ«±ÈʹÓó£¹æµÄ¡¢ÃæÏò¼¯µÄSQLÓï¾äÐèÒª¸ü´óµÄ¿ª Ïú£»°´ÕÕÌض¨Ë³ÐòÌáÈ¡Êý¾ÝµÄ²éÕÒ¡£
2¡¢   ±ÜÃâʹÓò»¼æÈݵÄÊý¾ÝÀàÐÍ¡£ÀýÈçfloatºÍint¡¢charºÍvarchar¡¢binaryºÍvarbinaryÊDz»¼æÈݵġ£Êý¾ÝÀàÐ͵IJ»¼æÈÝ¿ÉÄÜʹÓÅ»¯Æ÷ÎÞ·¨Ö´ÐÐһЩ±¾À´¿ÉÒÔ½øÐеÄÓÅ»¯²Ù×÷¡£ÀýÈç:
SELECT name from employee WHERE salary £¾ 60000
ÔÚÕâÌõÓï¾äÖÐ,Èçsalary×Ö¶ÎÊÇmoneyÐ͵Ä,ÔòÓÅ»¯Æ÷ºÜÄѶÔÆä½øÐÐÓÅ»¯,ÒòΪ60000ÊǸöÕûÐÍÊý¡£ÎÒÃÇÓ¦µ±ÔÚ±à³Ìʱ½«ÕûÐÍת»¯³ÉΪǮ±ÒÐÍ,¶ø²»ÒªµÈµ½ÔËÐÐʱת»¯¡£
3¡¢   ¾¡Á¿±ÜÃâÔÚWHERE×Ó¾äÖжÔ×ֶνøÐк¯Êý»ò±í´ïʽ²Ù×÷£¬Õ⽫µ¼ÖÂÒýÇæ·ÅÆúʹÓÃË÷Òý¶ø½øÐÐÈ«±íɨÃè¡£È磺
SELECT * from T1 WHERE F1/2=100
Ó¦¸ÄΪ:
SELECT * from T1 WHERE F1=100*2
SELECT * from RECORD WHERE SUBSTRING(CARD_NO,1,4)=’5378’
Ó¦¸ÄΪ:
SELECT * from RECORD WHERE CARD_NO LIKE ‘5378%’
SELECT member_number, first_name, last_name  from members
WHERE DATEDIFF(yy,datofbirth,GETDATE()) > 21
Ó¦¸ÄΪ:
SELECT member_number, first_name, last_name  from members
WHERE dateofbirth < DATEADD(yy,-21,GETDATE())
¼´£ºÈκζÔÁеIJÙ×÷¶¼½«µ¼Ö±íɨÃ裬Ëü°üÀ¨Êý¾Ý¿âº¯Êý¡¢¼ÆËã±í´ïʽµÈµÈ£¬²éѯʱҪ¾¡¿ÉÄܽ«²Ù×÷ÒÆÖÁµÈºÅÓұߡ£
4¡¢   ±ÜÃâʹÓÃ!=»ò£¼£¾¡¢IS NULL»òIS NOT NULL¡¢IN £¬NOT INµÈÕâÑùµÄ²Ù×÷·û,ÒòΪÕâ»áʹϵͳÎÞ·¨Ê¹ÓÃË÷Òý,¶øÖ»ÄÜÖ±½ÓËÑË÷±íÖеÄÊý¾Ý¡£ÀýÈç:
SELECT id from employee WHERE id != 'B%'
ÓÅ»¯Æ÷½«ÎÞ·¨Í¨¹ýË÷ÒýÀ´È·¶¨½«ÒªÃüÖеÄÐÐÊý,Òò´ËÐèÒªËÑË÷¸Ã±íµÄËùÓÐÐС£
 
5¡¢   ¾¡Á¿Ê¹ÓÃÊý×ÖÐÍ×ֶΣ¬Ò»²¿·Ö¿ª·¢ÈËÔ±ºÍÊý¾Ý¿â¹ÜÀíÈË


Ïà¹ØÎĵµ£º

SQL server 2008 ÆóÒµ°æ

ºú»Ô£º13028803715       0755-82945017
9¡¢ÉîÛÚmicrosoft Windows 2003 Server±¨¼Û ÖÐÎıê×¼°æ5Óû§    4100
10¡¢ÉîÛÚmicrosoft Windws 2003 Server±¨¼Û ÖÐÎÄÆóÒµ°æ25Óû§   20500
11¡¢ÉîÛÚmicrosoft Windows 2008 Server±¨¼Û ÖÐÎıê×¼°æ5Óû§   580 ......

ÈçºÎÁ´½Óµ½Sql Server 2005


SQL Server 2005
±¾Æª½éÉÜÈçºÎÁ´½Óµ½Sql Server 2005.
²ÉÓÃSQL ±¾µØ¿Í»§ ODBCÇý¶¯
²ÉÓÃSqlÉí·ÝÑéÖ¤
Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
ÄãÕýÔÚʹÓÃSQL Server 2005 Express£¿±ðÍü¼ÇÁË£¬ServernameµÄÓï·¨ÊÇServername\SQLEXPRESS£¬Äã¿ÉÒÔÓÃÄã°²× ......

Sql ÀïÃæ ROW_NUMBER Ó¦Óó¡¾°

ROW_NUMBER ·µ»Ø°´Ò»¶¨¹æÔòÅÅÐòµÄµ±Ç°¼Ç¼¶ÔÓ¦µÄÐкÅ
±ÈÈçÎÒÃÇÓÐÕâÑùÒ»¸öÓ¦Óó¡¾°£º
ÏÖÔÚÓиö±ÈÈü£¬ÐèÒª´ÓÍøÉϲÎÈüÕß´Ó´ÓÍøÂçÉϱ¨Ãû£¬È»ºóÈ¥×îÔ籨ÃûµÄ5¸öÈ˲μӱÈÈü£¬Îª´ËÎÒÃÇʵÏÖÈçÏ£º
1.Ϊ´ËÎÒÃÇÒª½¨Á¢Ò»ÕűíÀ´±£´æ±¨Ãû²ÎÈüÕßµÄÐÕÃû¼°Æð±¨Ãûʱ¼ä
CREATE 
TABLE [dbo].[UserEnroll](
[UserName] [nvarchar] ......

SQL Server 2005/2008¹ÜÀí£¨´ýÐø£©

-- ²é¿´µ±Ç°dbµÄµÇ½
select * from sys.sql_logins
-- ²é¿´ÐÔÄܼÇÊýÆ÷
SELECT * from sys.dm_os_performance_counters
-- Ö´ÐйýµÄÏß³ÌËùÓöµ½µÄËùÓеȴý(²»Êǵ±Ç°ÕýÔÚÔËÐеÄÏß³Ì, Ϊ×ÔÉÏ´ÎÖØÖÃͳ¼ÆÐÅÏ¢»òÆô¶¯·þÎñÆ÷ÒÔÀ´ÀÛ»ýµÄÊý¾Ý),¿É·ÖÎö¿¿Ç°µÄ¼¸¸öµÈ´ý½Ï¸ßµÄʼþ¡£
select * from sys.dm_os_wait_stats order by wa ......

Excelµ¼ÈëSQL£¨2£©

      ÓõÚÒ»ÖÖ·½·¨£¬ÉÏ´«·þÎñÆ÷ºó£¬ÔÚһЩ·þÎñÆ÷ÖУ¬¿ÉÄÜ»á³öÏÖÒÔÏ´íÎó£º
    ±ØÐëÔÚweb.configÖÐ¼Ó <system.web><identity impersonate="false"/></system.web> ,·ñÔò³öÏÖ´íÎó£ºSystem.Data.OleDb.OleDbException: δָ¶¨µÄ´íÎó¡£¼ÓÁËÒԺ󣬵ã¶à¼¸´ÎÁ´½Ó£¬» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ