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

½«Excelת»»³ÉsqlÎļþ£¬²åÈëÊý¾Ý¿â

ÐèÇó£ºÓÐexcelÎļþ£¬º¬¶à¸ösheet£¬Ã¿¸ösheetµÄÄÚÈݶÔÓ¦²åÈëµ½Ò»ÕÅ±í£¬sheetµÄÃû³Æ¾ÍÊǶÔÓ¦µÄ±íÃû³Æ¡£
 Ã¿Ò»ÐÐΪÁÐÃû£¬ÀýÈ磺
´ï³É£º½«Ã¿¸ösheetÊä³ö³ÉÒ»¸öÒÔsheetÃû³ÆÃüÃûµÄsqlÎļþ£¬ÄÚÈÝΪÿÐÐÄÚÈݵÄinsertÓï¾ä¡£
ÒÔÉÏͼΪÀý»áÉú³ÉÈý¸ösqlÎļþ£¬·Ö±ðÊÇTF_R_TERMINAL_ARCH.sql£¬ TF_R_STOCK_TRADE.sql ºÍ TF_R_STOCK_TRADE_DETAIL.sql  ÈçÏÂͼ
ÏÂÃæÊdzÌÐòExcelToInsert.java
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import jxl.Sheet;
import jxl.Workbook;
public class ExcelToInsert {
public static void main(String[] args) {
String table_name = ""; // ±íÃû
String sqlCell = ""; // ±íµ¥Ôª¸ñ
String SQL = ""; // ÍêÕûµÄÒ»ÌõSQL²åÈëÓï¾ä
final String EXL_NAME = "20100419"; // ExcelÎļþÃû
final String BASE_PATH = "F:/temp/"; // Îļþ·¾¶
final String IN_EXL_PATH = BASE_PATH + EXL_NAME + ".xls"; // excelPath
FileWriter fw = null;
int rows = 0;
int columns = 0;
try {
try {
Workbook rwb = Workbook.getWorkbook(new File(IN_EXL_PATH));
Sheet rs[] = rwb.getSheets();
// ±éÀúsheet
for (int i = 0; i < rs.length; i++) {
table_name = rwb.getSheetNames()[i]; // ±íÃûÈ¡sheetName
fw = new FileWriter(BASE_PATH + table_name + ".sql");
String preSql = "INSERT INTO TABLE "; // insertÓï¾äµÄÇ°°ë²¿·Ý
preSql += table_name + "(";
rows = rs[i].getRows();
columns = rs[i].getColumns();
// ±éÀúÐÐ
for (int j = 0; j < rows; j++) {
String sufSql = " VALUES( ";
if (j == 0) {// µÚÒ»ÐУ¬ÓÃÓÚÈ¡ÁÐÃû£¬ÔìinsertÓï¾äÇ°°ë²¿·Ý£¬Õⲿ·Ý¶ÔÓÚͬһÕűíÊÇÏàͬµÄ
for (int g = 0; g < columns - 1; g++) {
sqlCell = rs[i].getCell(g, 0).getContents().trim();
preSql += sqlCell + ",";
}
// insertÓï¾äÇ°°ë²¿·ÝÉú³É
preSql += rs[i].getCell(columns - 1, 0).getContents().trim()+ ") ";
}
// ÆäËüÐУ¬È¡¾ßÌåinsertµÄÄÚÈÝ£¬¼ÈinsertÓï¾äµÄºó°ë²¿·Ý
else {
for (int g = 0; g < columns - 1; g++) {
sqlCell = rs[i].ge


Ïà¹ØÎĵµ£º

ÔõÑù½«oracleÖÐµÄ±íµ¼Èësql server

1¡¢ÔÚÄ¿µÄSQL ServerÊý¾Ý¿â·þÎñÆ÷ÉÏ°²×°ORACLE ClientÈí¼þ»òÕßORACLE ODBC Driver.
ͨ¹ýoracle¿Í»§¶Ë£¬ÔÚnetmanagerÖн¨Á¢“·þÎñ£¨TNS server£©”£¬²¢²âÊÔÁ¬½ÓÉÏoracleÊý¾Ý¿âÕý³£
2¡¢ÔÚsqlserverµÄDTS(µ¼ÈëºÍµ¼³öÊý¾Ý¹¤¾ß)½øÐÐ
£¨1£©Ñ¡ÔñÊý¾ÝÔ´£º
Êý¾ÝÔ´£ºoracle in oracle9i
Ñ¡Ôñ£ºÓû§/ϵͳDSN:
µã»÷н¨ ......

Ó°ÏìSQL serverÐÔÄܵĹؼüÈý¸ö·½Ãæ

1 Âß¼­Êý¾Ý¿âºÍ±íµÄÉè¼Æ
Êý¾Ý¿âµÄÂß¼­Éè¼Æ¡¢°üÀ¨±íÓë±íÖ®¼äµÄ¹ØϵÊÇÓÅ»¯¹ØϵÐÍÊý¾Ý¿âÐÔÄܵĺËÐÄ¡£Ò»¸öºÃµÄÂß¼­Êý¾Ý¿âÉè¼Æ¿ÉÒÔΪ
ÓÅ»¯Êý¾Ý¿âºÍÓ¦ÓóÌÐò´òÏÂÁ¼ºÃµÄ»ù´¡¡£
±ê×¼»¯µÄÊý¾Ý¿âÂß¼­Éè¼Æ°üÀ¨ÓöàµÄ¡¢ÓÐÏ໥¹ØϵµÄÕ­±íÀ´´úÌæºÜ¶àÁеij¤Êý¾Ý±í¡£ÏÂÃæÊÇһЩʹÓñê×¼»¯
±íµÄһЩºÃ´¦¡£
A:ÓÉÓÚ±íÕ­£¬Òò´Ë¿ÉÒÔʹŠ......

Oracle SQLÓÅ»¯¼¼ÇÉ

ÎÒ¾õµÃÖ÷ÒªÓ¦¸Ã´Ó5¸ö·½Ãæ½øÐе÷Õû£º
1.È¥µô²»±ØÒªµÄ´óÐͱíµÄÈ«±íɨÃè
2.»º´æСÐͱíµÄÈ«±íɨÃè
3.¼ìÑéÓÅ»¯Ë÷ÒýµÄʹÓÃ
4.¼ìÑéÓÅ»¯µÄÁ¬½Ó¼¼Êõ
5.¾¡¿ÉÄܼõÉÙÖ´Ðмƻ®µÄCost
ÏÖÔÚ¼òµ¥µÄ¾Ù¼¸¸öÀý×Ó
Where×Ó¾äÖÐÓГ!=”½«²»Ê¹ÓÃË÷Òý
select account_name from test where amount != 0  (²»Ê¹ÓÃ) ......

[SQL Server2008]MDX²éѯÓï¾ä

ÔÚEssbaseÖÐʹÓÃMDXÖ»ÄÜÓÃÓÚ²éѯ£¬Éв»ÄÜÀ´²Ù×÷Cube£¨MS SSASÖпÉÒÔʹÓÃMDXÀ´²Ù×÷CubeµÄ£©£¬ËùÒÔÕâÀïֻѧϰMDXµÄSelectÓï¾ä¡£
 
ÔÚѧϰµÄ¹ý³ÌÖУ¬ÎÒ¾õµÃ×îÓÐÄѶȵĵط½ÓÐÁ½¸ö¡£
Ò»ÊÇ£¬¶ÔOLAP¶àάµÄÀí½â¡£ÈçͬѧϰSQLÒ»Ñù£¬SQL×÷ÓõĶÔÏóÊÇ±í£¬±íµÄ½á¹¹¶¼ÊǶþάµÄ£¬±êʶÐÐÁм´¿É£»µ«ÊÇMDX×÷ÓõĶÔÏóÊǶàάÊý¾Ý¿â£¬ÄÇ ......

ÅäÖà SQL Server 2005 Ô¶³Ìµ÷ÊÔ´æ´¢¹ý³Ì

ÎÊÌâ:
    Äú¹¤×÷µÄ±¾»ú×°ÓÐVisual Studio 2005£¬¾ÖÓòÍøÖÐÓÐһ̨SQL Server 2005Êý¾Ý¿â·þÎñÆ÷£¬ÄãÏëͨ¹ý±¾»úÔ¶³Ìµ÷ÊÔSQL Server 2005·þÎñÆ÷ÉϵĴ洢¹ý³Ì¡£µ«ÊDz»ÖªµÀÈçºÎÅäÖûòÆôÓÃÔ¶³Ìµ÷ÊÔ£¿Ï£ÍûÕâƪÎÄÕ¶ÔÄúÓÐÓ᣶ÔÓÚÊý¾Ý¿âºÍVisual StudioÔÚͬһ»úÆ÷µÄ´æ´¢¹ý³Ìµ÷ÊÔ£¬Ô°×ÓÀïÒѾ­ÓÐһƪÒë×÷˵µÄºÜºÃÁË£¬¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ