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

ExcelÊý¾Ýµ¼ÈëSql Server³öÏÖNull

ÔÚExcelÖУ¬ÎÒÃÇʱ³£»áÅöµ½ÕâÑùµÄ×Ö¶Î(×î³£¼ûµÄ¾ÍÊǵ绰ºÅÂë)£¬¼´Óд¿Êý×ÖµÄ(ÈçûÓдøÇøºÅµÄµç»°ºÅÂë)£¬ÓÖÓÐÊý×ÖºÍÆäËü×Ö·û»ìºÏ (Èç“ÇøºÅ-µç
»°ºÅÂë”)µÄÊý¾Ý£¬ÔÚµ¼ÈëSQLServer¹ý³ÌÖУ¬»á·¢ÏÖҪô´¿Êý×ÖµÄÊý¾Ýµ¼¹ýÈ¥Ö®ºó±ä³ÉÁËNULL£¬ÒªÃ´¾ÍÊÇÊý×ÖºÍÆäËü×Ö·û»ìºÏµÄÊý¾Ýµ¼¹ýÈ¥Ö®ºó±ä³É
ÁËNULL¡£
    ΪʲôÓÐЩÊÇ´¿Êý×ÖµÄÊý¾Ýµ¼¹ýÈ¥Ö®ºó±ä³ÉÁËNULL£¬ÓÐЩȴÊÇÊý×ÖºÍÆäËü×Ö·û»ìºÏµÄÊý¾Ýµ¼¹ýÈ¥Ö®ºó±ä³ÉÁËNULL£¬Ô­À´ÊÇÔÚ½«ExcelÊý¾Ýµ¼Èë
SQLServer¹ý³ÌÖУ¬SQLServer»á×ö³öÅжϣ¬ÊDzÉÓÃfloatÐÍ»¹ÊÇnvarcharÐÍÀ´½ÓÊÜÊý¾Ý£¬²âÊÔ·¢ÏÖ(ûÓпÆѧÒÀ¾Ý)£¬SQLServer²ÉÓÃÄÄÒ»ÐÍÈ¡¾öÓÚ½«Òªµ¼Èë
µÄÊý¾ÝÖб¾Éí¾ßÓÐÄÄÒ»Ð͵ļǼÊý±ÈÀý¶à£¬Èç10±ÊÊý¾Ý£¬ÓÐ4±ÊûÓдøÇøºÅµÄµç»°ºÅÂ룬6±ÊÊÇ´øÇøºÅµÄµç»°ºÅÂ룬ÄÇôתµ½SQLServer¾Í»áÑ¡Ôñ
nvarcharÐÍ£¬½á¹û¾ÍÊÇ4±ÊûÓдøÇøºÅµÄµç»°ºÅÂëµ¼¹ýÈ¥Ö®ºóÈ«³ÉÁËNULL£¬·´Ö®ÒàÈ»¡£²»¹ÜÔõôÑù£¬ÎÒÃÇ×îÖÕ¶¼Ï£ÍûSQLServerÊDzÉÓÃnvarcharÀ´½ÓÊÜ
Êý¾Ý£¬±ÏÒâÎÒÃÇÒªµ¼ÈëµÄÊý¾ÝÖÐÓÐÊý×ÖºÍÆäËü×Ö·û»ìºÏµÄÊý¾Ý£¬ÓÃfloatÐÍÀ´½ÓÊÜÊDz»¿ÉÄܵģ¬ÕâÑùÖ»ÒªÎÒÃǽâ¾öÁ˽«´¿Êý×ÖµÄÊý¾Ýת»»³É×Ö·ûÐͲ¢ÈÃ
SQLServer½ÓÊܾͿÉÒÔÁË¡£
    ÎÒÊ×ÏÈÏëµ½µÄ¾ÍÊǽ«Õâ¸ö×ֶεÄËùÓÐÊý¾ÝÔÚExcelÖÐÉèÖÃΪÎı¾¸ñʽ£¬¸Õ²Å˵Á˱¾À´¾ÍÊÇÏ£Íûµ¼ÈëSQLServerʱ³ÉΪ×Ö·ûÐÍ£¬µ«½á¹ûÁîÈËʧÍû£¬²»Æð
×÷Óá£
    ×îÖÕÍøÉÏËÑË÷µ½Á˴𰸣º»ìºÏÊý¾ÝÀàÐÍÁеÄÇ¿ÖƽâÎö——IMEX=1
ʹÓà IMEX=1 Ñ¡²ÎÖ®ºó£¬Ö»ÒªÈ¡ÑùÊý¾ÝÀïÊÇ»ìºÏÊý¾ÝÀàÐ͵ÄÁУ¬Ò»ÂÉÇ¿ÖƽâÎöΪ nvarchar/ntext Îı¾¡£µ±È»£¬IMEX=1 ¶Ôµ¥Ò»Êý¾ÝÀàÐÍÁеĽâÎöÊDz»Ó°
ÏìµÄ¡£
SELECT * INTO Table08
from OpenDataSource
('Microsoft.Jet.OLEDB.4.0','Data Source="E:\1.xls";Extended properties="Excel 5.0;HDR=Yes;IMEX=1;"')...[Sheet1$]
    ×¢£º
    1.ÕâÌõÓï¾äÊÇÔÚSQLServer²éѯ·ÖÎöÆ÷ÖÐÖ´ÐУ¬²¢ÇÒҪѡÔñºÃÊý¾Ý¿â£¬·ñÔò»á°ÑÒªµ¼ÈëµÄÊý¾ÝÍù±ðµÄÊý¾Ý¿âÖе¼ÁË¡£
    2.Table08ÊÇÊý¾Ýµ¼ÈëºóÔÚSQLServerÖеıíÃû£¬ÊôÓÚн¨£¬ËùÒÔÇëÈ·ÈÏÔÚµ¼ÈëÊý¾ÝÇ°Êý¾Ý¿âÖÐûÓиñíÃû£¬·ñÔò»áÌáʾÒÑ´æÔÚͬһ±íÃû¡£
    3.Data Source£¬²»ÒªÁ¬ÔÚÒ»Æðд£¬ÖмäÓÐÒ»¿Õ¸ñ¡£
    4.E:\1.xls£¬ÎªExcelËùÔڵľø¶Ô·¾¶ºÍÊý¾Ý¿âÃû¡£
    5.Excel 5.0£¬¸ù¾Ý²»Í¬µÄExcel°æ±¾


Ïà¹ØÎĵµ£º

oracle sql ʱ¼ä¼ä¸ô¼ÆËã

¼ÆËã¼ä¸ôʱ¼ä£º
select f_date,f_cstime,f_cetime, (((SYSDATE- TO_DATE(f_date||f_cstime,'YYYYMMDDHH24MISS')) * 86400000)-((SYSDATE- TO_DATE(f_date||f_cetime,'YYYYMMDDHH24MISS')) * 86400000))/1000  CURRENT_MILLI from ycsq_t_hauthlog where f_cstime<>'999999'
½«×Ö·û´®×ª»»³ÉÈÕÆÚÀà:SYSDATE- TO_ ......

£¨×îгɹ¦£©Ãâ°²×°OracleÔËÐÐpl/sql developer

1.µ½http://www.oracle.com/technology/global/cn/software/tech/oci/instantclient/htdocs/winsoft.htmlÏÂÔØ
11.1.0.7.0 °æµÄ¼´Ê±¿Í»§¶Ë³ÌÐò°ü — Basic£¨²»ÊÇBasic Lite£©
2.½«ÏÂÔص½µÄÎļþ½âѹ£¬½âѹºóÎÒ½«Ä¿Â¼instantclient_11_1ÀïµÄÈ«²¿Îļþ¿½±´µ½ÁËÒ»¸öеÄĿ¼£ºE:\programs\OracleClient¡£ÄãÒ²¿ÉÒÔ²»¿½±´£¬Ö ......

sql server ÖÐÁÙʱ±íÓë±í±äÁ¿µÄÇø±ð

 
ÎÒÃÇÔÚÊý¾Ý¿âÖÐʹÓñíµÄʱºò,¾­³£»áÓöµ½Á½ÖÖʹÓñíµÄ·½·¨,·Ö±ð¾ÍÊÇʹÓÃÁÙʱ±í¼°±í±äÁ¿¡£ÔÚʵ¼ÊʹÓõÄʱºò£¬ÎÒÃÇÈçºÎÁé»îµÄÔÚ´æ´¢¹ý³ÌÖÐÔËÓÃËüÃÇ£¬ËäÈ»ËüÃÇʵÏֵŦÄÜ»ù±¾ÉÏÊÇÒ»ÑùµÄ£¬¿ÉÈçºÎÔÚÒ»¸ö´æ´¢¹ý³ÌÖÐÓÐʱºòȥʹÓÃÁÙʱ±í¶ø²»Ê¹Óñí±äÁ¿£¬ÓÐʱºòȥʹÓñí±äÁ¿¶ø²»Ê¹ÓÃÁÙʱ±íÄØ?
¡¡¡¡ÁÙʱ±í
¡¡¡¡ÁÙʱ±íÓëÓÀ¾Ã± ......

Java Ö´ÐÐ SQL ½Å±¾Îļþ

ÊÇ¿½±´µÄ±ðÈ˵ģ¬ÒÔ±¸Ñ§Ï°
package com.unmi.db;
import java.io.FileInputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* ¶ÁÈ¡ SQL ½Å±¾²¢Ö´ÐÐ
* @author Unmi
*/
pub ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ