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

SQL2005ºÍ(Excel |access)Ö®¼äµÄÊý¾Ýµ¼Èëµ¼³ö


Sql´úÂë
--²ÉÓÃSQLÓï¾äʵÏÖsql2005ºÍExcel Êý¾ÝÖ®¼äµÄÊý¾Ýµ¼Èëµ¼³ö£¬ÔÚÍøÉÏÕÒÀ´Ò»--Ï£¬ÊµÏÖ·½·¨ÊÇÕâÑùµÄ£º    
  
  
--Excel---->SQL2005  µ¼È룺    
  
  
select * into useinfo from OPENROWSET('MICROSOFT.JET.OLEDB.4.0' ,'Excel 5.0;HDR=YES;DATABASE=d:\db.xls',sheet1$);    
  
  
  
--ÆäÖУ¬useinfo ÊÇÊý¾Ý¿âÖеÄÒ»¸ö±í£¬d:\db.xls ÎªÊý¾ÝÔ´£¬ÖµµÃÌá³öµÄÊÇ£º--sheet1$£¬¼ÇµÃ¼ÓÉÏ$¡£    
  
  
---SQL2005--->Excel  µ¼³ö£º    
  
  
insert into OPENROWSET('MICROSOFT.JET.OLEDB.4.0' ,'Excel 5.0;HDR=YES;DATABASE=d:\test.xls',sheet1$) select * from useinfo;    
  
  
  
  
--н¨Ò»¸ötest.xml Îļþ£¬ÆäÖÐtest.xmlµÄsheet1 µÄ±íÍ·±ØÐëÒªºÍuseinfoµÄÁÐ----ÃûÏàÒ»ÖÂ.    
  
  
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    
  
  
----¸½ÉÏaccessµÄ    
  
  
insert into OpenRowSet('microsoft.jet.oledb.4.0',';database=d:\test.mdb','select * from useinfo')    
select * from useinfo;    
----------------------------------------------------------------------------    
select * into hi from     
OpenRowSet('microsoft.jet.oledb.4.0',';database=d:\test.mdb','select * from useinfo')    
  
  
  
``````````````````````````````````````````    


Ïà¹ØÎĵµ£º

¡¶£Ó£Ñ£Ì Óï·¨²Î¿¼ÊÖ²á(SQL)¡·

£Ó£Ñ£Ì Óï·¨²Î¿¼ÊÖ²á(SQL)/Êý¾ÝÀàÐÍ
DB2 ÌṩÁ˹ØÁ¬Ê½×ÊÁÏ¿âµÄ²éѯÓïÑÔ £Ó£Ñ£Ì (Structured Query Language)£¬ÊÇÒ»Öַdz£¿ÚÓﻯ¡¢¼ÈÒ×ѧÓÖÒ׶®µÄÓï·¨¡£´ËÒ»ÓïÑÔ¼¸ºõÊÇÿ¸ö×ÊÁÏ¿âϵͳ¶¼±ØÐëÌṩµÄ£¬ÓÃÒÔ±íʾ¹ØÁ¬Ê½µÄ*×÷£¬°üº¬ÁË×ÊÁϵĶ¨Ò壨£Ä£Ä£Ì£©ÒÔ¼°×ÊÁϵĴ¦Àí£¨£Ä£Í£Ì£©¡£SQLÔ­À´Æ´³ÉS ......

ÇÉÓÃSQL ServerÈÕÆÚÀàÐÍÊý¾Ý¶þ½øÖÆÊä³ö¼ÆËãʱ¼ä²î

1¡¢SQL ServerÈÕÆÚÊý¾Ý¿âÄÚ²¿±íʾ¼°²éѯÊä³ö£º
SQL ServerÄÚ²¿¶ÔDateTimeÀàÐ͵ıíʾÊÇÓÃ8¸ö×Ö½ÚÀ´±íʾ£¬ÆäÖÐÇ°4¸ö×Ö½Ú±íʾµÄÊýֵΪ×Ô1900Äê1ÔÂ1ÈÕÁãʱÒÔÀ´µÄÌìÊý£¬ºóËĸö×Ö½ÚÊÇÌìÊýÖ®ÍâµÄÓжàÉÙ¸ö1/300Ã룬ÕâҲ˵Ã÷SQL ServerÄÚ²¿±íʾʱ¼äµÄ¾«¶ÈΪ1/300Ã룬Լ3.3ºÁÃë¡£
³£¹æµÄSQL²éѯ£¬Õý³£ÈÕÆÚÊä³ö¸ñʽΪ:yyyy-MM-dd hh: ......

SQL×Ö·û´®²Ù×÷º¯Êý´óÈ«

selectÓï¾äÖÐÖ»ÄÜʹÓÃsqlº¯Êý¶Ô×ֶνøÐвÙ×÷£¨Á´½Ósql server£©£¬
select ×Ö¶Î1 from ±í1 where ×Ö¶Î1.IndexOf("ÔÆ")=1;
ÕâÌõÓï¾ä²»¶ÔµÄÔ­ÒòÊÇindexof£¨£©º¯Êý²»ÊÇsqlº¯Êý£¬¸Ä³Ésql¶ÔÓ¦µÄº¯Êý¾Í¿ÉÒÔÁË¡£
left£¨£©ÊÇsqlº¯Êý¡£
select ×Ö¶Î1 from ±í1 where charindex£¨'ÔÆ',×Ö¶Î1£©=1;
×Ö·û´®º¯Êý¶Ô¶þ½øÖÆÊý¾Ý¡¢×Ö·û´®º ......

SQL³£ÓÃÓï¾ä

1¡¢Óëgroup by´îÅäʹÓõĺ¯Êý
ÔÚÊý¾Ý¿âÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃGROUP BYº¯Êý°ÑÊý¾Ý×éºÏÔÚÒ»Æ𣬴Ӷø»ñµÃ×ܼÆÐÅÏ¢¡£¿ÉÒ԰Ѵ˹¦ÄÜ¿´³ÉÊÇÒ»ÖÖµ±Êý¾Ý´ÓÊý¾Ý¿âÖзµ»Øʱ°ÑÏàͬÀàÐ͵ÄÐÅÏ¢¼¯Öе½Ò»ÆðµÄÄÜÁ¦¡£ÏÂÃæ¸ø³öÁËÍêÕûÁÐ±í¡£
avg([distinct]column_name)
ÇóËùÓйÍԱнˮµÄƽ¾ùÖµ¡£
select AVG(emp_salary)
from employee;
ÇóÈ¡c ......

½«AccessµÄÄÚÈÝǨÒƵ½MySQLÊý¾Ý¿â

Ô­±¾µÄÄ¿µÄÊǽ«Êý¾Ý¿â´ÓMS SQL 2000ǨÒƵ½MySQLÖУ¬µ«ÌáʾJDBCÁ¬½Óʧ°Ü£¬ÎÞÄÎÖ®¼«£¬Ö»ºÃÑ¡ÔñÖмäÇÅÁºAccessÍê³ÉÕâÏîÁîÈËÌÖÑáµÄ¹¤×÷ÁË¡£
´ó¸Å²½ÖèÈçÏ£º
1£¬´ÓMS SQL 2000½«Êý¾Ýµ¼³öµ½AccessÖУ¬ÓÐ¹Ø±í¶¨ÒåºÃÖ÷¼üºÍ×Ô¶¯±àºÅ²¿·Ö²»È»Ç¨ÒƺóÓÖµÃÐÞ¸ÄMySQLµÄ±í¡£
2£¬ÐÞ¸ÄAccess±íÖйÜÀíÔ±×é¡¢¹ÜÀíÔ±µÄȨÏÞ£¬±£Ö¤AccessµÄÄÚÖà ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ