ÈçºÎ¸ßЧµÄ½«excelµ¼Èësqlserver£¿
¡¡¡¡´ó²¿·ÖÈ˶¼ÖªµÀÓÃoledbÀ´¶ÁÈ¡Êý¾Ýµ½dataset£¬µ«ÊǶÁÈ¡Ö®ºóÔõô´¦Àídataset¾ÍǧÆæ°Ù¹ÖÁË¡£ºÜ¶àÈËͨ¹ýÑ»·À´Æ´½Ósql£¬ÕâÑù×ö²»µ«ÈÝÒ׳ö´í¶øÇÒЧÂʵÍÏ£¬System.Data.SqlClient.SqlBulkCopy ¶ÔÓÚÐÂÊÖÀ´Ëµ»¹ÊDZȽÏÄ°ÉúµÄ£¬Õâ¸ö¾ÍÊÇ´«ËµÖÐЧÂʼ«¸ßµÄbcp£¬6Íò¶àÊý¾Ý´Óexcelµ¼Èëµ½sqlÖ»ÐèÒª4.5Ãë¡£
using System;
using System.Data;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//²âÊÔ£¬½«excelÖеÄsheet1µ¼Èëµ½sqlserverÖÐ
string connString = "server=localhost;uid=sa;pwd=sqlgis;database=master";
System.Windows.Forms.OpenFileDialog fd = new OpenFileDialog();
if (fd.ShowDialog() == DialogResult.OK)
{
TransferData(fd.FileName, "sheet1", connString);
}
}
public void TransferData(string e
Ïà¹ØÎĵµ£º
1.oracle»·¾³
create table test
(
id number(4),
name varchar2(20)
)
ÔÚÒ»¸ösessionÖÐ
insert into test values(1,'aa');
ÔÚÁíÒ»¸ösessionÖÐ
select * from test1;
²éѯû±»×èÈû
2.sqlserver»·¾³
ÔÚÒ»¸ösessionÖÐ
insert into test values(1,'aa');
ÔÚÁíÒ»¸ösessionÖÐ
select * from test1;
²éѯ±»×èÈû(Ê ......
bcpÃüÁîÊÇSQL ServerÌṩµÄÒ»¸ö¿ì½ÝµÄÊý¾Ýµ¼Èëµ¼³ö¹¤¾ß¡£Ê¹ÓÃËü²»ÐèÒªÆô¶¯ÈκÎͼÐιÜÀí¹¤¾ß¾ÍÄÜÒÔ¸ßЧµÄ·½Ê½µ¼Èëµ¼³öÊý¾Ý¡£bcpÊÇSQL ServerÖиºÔðµ¼Èëµ¼³öÊý¾ÝµÄÒ»¸öÃüÁîÐй¤¾ß£¬ËüÊÇ»ùÓÚDB-LibraryµÄ£¬²¢ÇÒÄÜÒÔ²¢Ðеķ½Ê½¸ßЧµØµ¼Èëµ¼³ö´óÅúÁ¿µÄÊý¾Ý¡£bcp¿ÉÒÔ½«Êý¾Ý¿âµÄ±í»òÊÓͼֱ½Óµ¼³ö£¬Ò²ÄÜͨ¹ýSELECT fromÓï¾ä¶Ô±í»òÊÓ ......
Oracle´æ´¢¹ý³Ìת³ÉSqlserver´æ´¢¹ý³Ì
1.ÈÕÆÚת»»
Oracle£º TO_NUMBER(TO_CHAR(SYSDATE, 'YYYYMMDD'))
SqlServer£ºCAST(CONVERT(CHAR(8),GETDATE(), 112) AS INT)
×¢£ºÆäÖБYYYYMMDD’¸ñʽ ¶ÔÓ¦112
2.ROWIDת»»
Oracle£º ROWID
SqlServer: PRIMARY KEY(±íÖ÷¼ü)
3.ROWNUM ......
eg:
select * from Exception_Log where DATEDIFF(day,OPER_DATE,getdate())<30 ;
/*
oper_date Ϊ±íÖвéѯ³öÀ´µÄʱ¼ä
getdate()ΪSQLServerÀïÃæ»ñµÃϵͳʱ¼äµÄº¯Êý
º¬Ò壺µ±Ç°Ê±¼ä-²éѯ³öÀ´µÄʱ¼äСÓÚ30Ìì
DateDiff¾ßÌåÓ÷¨£º
*/
DateDiff º¯Êý
·µ»ØÁ½¸öÈÕÆÚÖ®¼äµÄʱ¼ä¼ä¸ô¡£
DateDiff(interval, date1, da ......
¼Ç¼һÏÂÒÔ±¸Ï´οìËÙÕÒµ½¡£¡£¡£
Íùtb_wf_privgrant±íÖвåÈëÒ»Ìõ¼Ç¼£¬workflow_id×Ö¶ÎÖµ´Ótb_wf_workflow ±íÖлñÈ¡workflow_name='֪ʶÉóºË'µÄËùÓмǼÖÐworkflow_id×î´óÖµ¡£
--oracle
declare a NUMBER(10);
begin
select max(wo ......