EXCLEµ¼ÈëSQL ServerµÄÁ½¸öÎÊÌâ
½ñÌìÓöµ½Ò»¸ö¿Í»§£¬°Ñ×Ô¼ºÖ®Ç°¸éÖõÄÎÊÌâ°Úµ½ÁËÃæÇ°£¬´ëÊÖ²»¼°Ï´¦ÀíÆðÀ´×ßÁ˲»ÉÙÍä·£¬×îÖÕҲûÓÐÍêÈ«½â¾ö£¬Ö÷Òª»¹ÊǼ¼Êõ´¢±¸²»¹»¡£ÆäÖÐÓйØEXCLEÊý¾Ýµ¼ÈëSQL2000ʱÓöµ½Á½¸öÎÊÌ⣬ÔÚÍøÉÏËÑË÷Á˽â¾ö°ì·¨£¬ÊÕ²ØÒ»Ï£º
1¡¢½«Excelµ¼Èëµ½SQL severÊý¾Ý¿â£¬Ìáʾ˵“Íⲿ±í²»ÊÇÔ¤ÆÚµÄ¸ñʽ”
¿ÉÄܵÄÔÒò£ºÓбíÍ·¡¢»òÕßÊǸñʽÉÏÓкϲ¢µ¥Ôª¸ñÖ®ÀàµÄ
½â¾ö°ì·¨£º°Ñ±íÖеÄÊý¾Ý¸´ÖÆÒ»Ï£¬Ê¹ÓÃÖ»Õ³ÌùÊý¾Ýµ½Ò»¸öбíÖУ¬µ¼Èëбí
£¨Õª×Ôhttp://zhidao.baidu.com/question/86652526.html?fr=ala1£©
2¡¢ExcelÊý¾Ýµ¼ÈëSql Server³öÏÖNull
ÒýÆðµÄÔÒò£ºµ¼ÈëΪNullµÄÊý¾ÝÁÐÊôÓÚ»ìºÏÊý¾ÝÀàÐÍÁÐ
½â¾ö°ì·¨£ºÇ¿ÖƽâÎö——IMEX=1(ʹÓà IMEX=1 Ñ¡²ÎÖ®ºó£¬Ö»ÒªÈ¡ÑùÊý¾ÝÀïÊÇ»ìºÏÊý¾ÝÀàÐ͵ÄÁУ¬Ò»ÂÉÇ¿ÖÆ½âÎöΪ nvarchar/ntext Îı¾)
SELECT * INTO Table
from OpenDataSource
('Microsoft.Jet.OLEDB.4.0','Data Source="E:\1.xls";Extended properties="Excel 5.0;HDR=Yes;IMEX=1;"')...[Sheet1$]
£¨Õª×Ôhttp://hi.baidu.com/hackerxxw/blog/item/b5e5fcde4fb0f45c94ee3798.html£©
Ïà¹ØÎĵµ£º
insert into Country123 ([Country_Id], [Region_ID], [Country_EN_Name], [Country], [Country_ALL_ID], [Country_Order_Id]) select [Country_Id], [Region_ID], [Country_EN_Name], [Country], [Country_ALL_ID], [Country_Order_Id] from openrowset( 'Microsoft.Jet.OLEDB.4.0', 'EXCEL 5.0;HDR=YES;IMEX=1; DATABASE= ......
ÎÒÃÇÔÚÊý¾Ý¿âÖÐʹÓñíµÄʱºò,¾³£»áÓöµ½Á½ÖÖʹÓñíµÄ·½·¨,·Ö±ð¾ÍÊÇʹÓÃÁÙʱ±í¼°±í±äÁ¿¡£ÔÚʵ¼ÊʹÓõÄʱºò£¬ÎÒÃÇÈçºÎÁé»îµÄÔÚ´æ´¢¹ý³ÌÖÐÔËÓÃËüÃÇ£¬ËäÈ»ËüÃÇʵÏֵŦÄÜ»ù±¾ÉÏÊÇÒ»ÑùµÄ£¬¿ÉÈçºÎÔÚÒ»¸ö´æ´¢¹ý³ÌÖÐÓÐʱºòȥʹÓÃÁÙʱ±í¶ø²»Ê¹Óñí±äÁ¿£¬ÓÐʱºòȥʹÓñí±äÁ¿¶ø²»Ê¹ÓÃÁÙʱ±íÄØ?
¡¡¡¡ÁÙʱ±í
¡¡¡¡ÁÙʱ±íÓëÓÀ¾Ã±íÏàËÆ£¬ ......
²éÑ¯ÖØ¸´Öµ£¬ÏÔʾ³ö²»Öظ´µÄ²¿·Ö
select distinct(employeeid) from orders
²éѯÁ½¸ö±íÖ®¼äÏàͬÊý¾Ý
select orders.EmployeeID,Employees.EmployeeID
from orders INNER JOIN Employees
on Employees.EmployeeID=orders.EmployeeID
ʵÏÖÄ¿µÄ£¬Ò»¸ö±í´æ·ÅÓû§±àºÅºÍÓû§Ãû£¬ÔÚÁíÒ»¸ö±íÖпÉÒÔ¸ù¾ÝÓû§±àº ......
ÈκÎÒ»ÖÖʹÓÃÊý¾Ý¿âweb³ÌÐò£¨µ±È»£¬Ò²°üÀ¨×ÀÃæ³ÌÐò£©¶¼Óб»SQL×¢ÈëµÄ·çÏÕ¡£·ÀÖ¹±»SQL×¢È룬×î»ù±¾µÄ·½·¨ÊÇÔÚ´úÂë¼¶±ð¾ÍÒª×èÖ¹ÕâÖÖ¿ÉÄÜ£¬Õâ¸öÍøÉϽ²µÄºÜ¶à£¬ÎҾͲ»¶à˵ÁË¡£²»¹ýÈç¹ûÄãÄõ½µÄÊÇÒ»¸öÒѾÍ깤µÄ²úÆ·£¬Õâ¸öʱºò¸ÃÈçºÎ½â¾öÄØ£¿ÎÒ½éÉܼ¸ÖÖ¶ÔÓÚASPºÍASP.NETÓÐЧµÄ·ÀÖ¹SQL×¢ÈëµÄ·½°¸£¬¶øÇÒÊÇÃâ·ÑµÄ¡£
UrlScan 3.1
......
import java.sql.*;
public class JdbcUtil
{
public static void close(Statement st, Connection con)
{
try
{
&nb ......