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

delphiµ¼Èëexcelµ½sqlserverµÄsqlÓï¾äÎÊÌâ

'Select * into '+TempTableName+' from OpenDataSource(''Microsoft.JET.OLEDB.4.0'',''Data Source='
  +ExcelFilePath+';Mode=Read;Extended Properties=Excel 5.0;Persist Security Info=True'')...['
  +SheetName+'$]';
Èç¹ûÎÒµÄexcel±íÖеÄsheetname´øÓС°£¨£©¡±£¨±ÈÈçsheetnameÊÇ£º¼Û¸ñ£¨Ïêϸ£©£©Õâ¸öµÄ»°£¬Õâ¾äÓï¾ä¾Í»á±¨´í¡£
ÔÚÎÒ²»ÐÞ¸ÄsheetnameµÄÇ°ÌáÏ£¬ÎÒÔõôÈÃÕâ¸ösqlÓï¾ä²»±¨´í£¬ÄÜÕýÈ·Ö´ÐÐÄØ£¿



'SELECT * into '+TempTableName+' from openrowset(''MICROSOFT.JET.OLEDB.4.0'',
''Excel 5.0;HDR=YES;DATABASE='+ExcelFilePath+''',''select * from ['+SheetName+'$]'')';

ѧϰ

ÒýÓÃ
'Select * into '+TempTableName+' from OpenDataSource(''Microsoft.JET.OLEDB.4.0'',''Data Source='
  +ExcelFilePath+';Mode=Read;Extended Properties=Excel 5.0;Persist Security Info=True'')...['
  +SheetName+'$]';
Èç¹ûÎÒµÄexcel±íÖеÄsheetname´øÓС°£¨£©¡±£¨±ÈÈçsheetnameÊÇ£º¼Û¸ñ£¨Ïêϸ£©£©Õâ¸öµÄ»°£¬Õâ¾äÓï¾ä¾Í»á±¨´í¡£
ÔÚÎÒ²»ÐÞ¸ÄsheetnameµÄÇ°ÌáÏ£¬ÎÒÔõôÈÃÕâ¸ösqlÓï¾ä²»±¨´í£¬ÄÜÕýÈ·Ö´ÐÐÄØ£¿


´ó¸ç£¬ÎÒµÄÎÊÌâ²»ÊDz»»áµ¼È룬Êǵ¼ÈëµÄʱºòsheetnameÈç¹ûÓС°()¡±Õâ¸ö×Ö·ûµÄ»°¾Íµ¼Èëʧ°Ü¡£


Ïà¹ØÎÊ´ð£º

SQLÓï¾äЧÂÊÎÊÌâ - ÆäËûÊý¾Ý¿â¿ª·¢ / ÆäËûÊý¾Ý¿â

´ó¼Ò°ïæ¿´¿´Õâ2¸ösqlÓï¾äÄĸö²éѯµÄËٶȸü¿ìµã¡£Ð»Ð»°ïæ¡£±È½Ï׿±¡£ÔÚ×öÐÔÄܲâÊÔ¡£
select * from
  ±íA LEFT OUTER JOIN ±íB ON (±íA.id || ' ' =±íB.id) ,±íC , ±íD, ±íE
WhereÆäËûÌõ¼þ
select * ......

sql¿ÉÒÔÓÐÁ½¸öÒÔÉϵĴ¥·¢Æ÷Â𣿣¿

sql¿ÉÒÔÓÐÁ½¸öÒÔÉϵĴ¥·¢Æ÷Â𣿣¿ÎÒÖ¸µÄÊÇfor´¥·¢Æ÷£¬ÄÇÆäËûµÄÄØ£¿£¿
ʲôÒâ˼£¿

¿ÉÒÔµÄ

10¸ö¶¼Ã»ÎÊÌâ

¿ÉÊÇÎÒдÁËÁ½¸öfor insert ´¥·¢Æ÷£¬Ôì³É½ø³Ì×èÈûÁËÄØ£¿Ôõô°ìÄØ£¿Çë¸ßÈËÖ¸µã
......

sqlÓï¾ä¶à±í¶à×ֶβéѯ - MS-SQL Server / »ù´¡Àà

ÎÒÓжà¸ö±íA B C ½á¹¹ÊÇÒ»ÑùµÄ£¬¶¼ÓÐ2¸ö×Ö¶ÎnameºÍcontent,ÎÒÒªËÑË÷ËùÒÔ±íËùÓÐ×Ö¶ÎÖаüº¬¡°Öйú¡±µÄÄÚÈÝ Õâ¸öSQLÓï¾äÔõôд 

ÈçºÎ½«¶à¸ö±íµÄ²éѯ½á¹ûÁ¬³ÉÒ»¸ö±í Õâ¸öSQLÓï¾äÔõôд ±íµÄ½á¹¹ÊÇÒ»ÑùµÄ
ÀýÈç£ ......

ado·ÃÎÊÔ¶³ÌÊý¾Ý¿â(Ô¶³Ì·ÃÎÊsqlserver)

ÊÇÕâÑùµÄ£¬ÎÒÓÃÊÇODBCÊý¾ÝÔ´Á¬½Ó·þÎñÆ÷µÄÊý¾Ý¿â£¬ÏÖÔÚÎÒ¾õµÃºÜÂé·³£¬ÒòΪҪΪÿÈç»úÌí¼Ó¶ÔÓ¦µÄÊý¾ÝÔ´£¬Ïë°ÑËû¸Ä³ÉADO·½·¨À´·ÃÎÊ·þÎñÆ÷µÄÊý¾Ý¿âÄÜʵÏÖÂð£¿ÒªÔõôд¡£
±ÈÈç·þÎñÆ÷ÀïÓжþ¸öÊý¾Ý¿âdata1 ºÍdata2£¬¿Í»§ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ