½«ExcelµÄÊý¾Ýµ¼Èëµ½SQL 2005ÏÖÓеıíÖÐ
ÎÒÔÚ½«ExcelµÄÊý¾Ýµ¼Èëµ½SQLµÄʱºòÀÏÊdzöÏÖÏÂÃæµÄ´íÎó£º
ÅäÖÃÑ¡Ïî 'show advanced options' ÒÑ´Ó 1 ¸ü¸ÄΪ 1¡£ÇëÔËÐÐ RECONFIGURE Óï¾ä½øÐа²×°¡£
ÅäÖÃÑ¡Ïî 'Ad Hoc Distributed Queries' ÒÑ´Ó 1 ¸ü¸ÄΪ 1¡£ÇëÔËÐÐ RECONFIGURE Óï¾ä½øÐа²×°¡£
ÏûÏ¢ 7399£¬¼¶±ð 16£¬×´Ì¬ 1£¬µÚ 1 ÐÐ
Á´½Ó·þÎñÆ÷ "(null)" µÄ OLE DB ·ÃÎÊ½Ó¿Ú "MICROSOFT.JET.OLEDB.4.0" ±¨´í¡£Ìṩ³ÌÐòδ¸ø³öÓйشíÎóµÄÈκÎÐÅÏ¢¡£
ÏûÏ¢ 7303£¬¼¶±ð 16£¬×´Ì¬ 1£¬µÚ 1 ÐÐ
ÎÞ·¨³õʼ»¯Á´½Ó·þÎñÆ÷ "(null)" µÄ OLE DB ·ÃÎÊ½Ó¿Ú "MICROSOFT.JET.OLEDB.4.0" µÄÊý¾ÝÔ´¶ÔÏó¡£
ÎÒ½«´úÂëÌù³öÀ´£¬Íû´ó¼Ò°ïæָµãһϰ¡£¡·Ç³£¸Ðл£¡
/// <summary>
/// ´ò¿ªÎļþ
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.ShowDialog();
ofd.Filter = "Excel Îļþ(*.xls)|";
ofd.ValidateNames = true;
ofd.CheckPathExists = true;
ofd.CheckFileExists = true;
string filepath = ofd.FileName;
this.textBox1.Text = filepath;
}
public void ExecMothod()
{
&nb
Ïà¹ØÎĵµ£º
SQL Server ·ÖÒ³
½¨Á¢±í£º
CREATE TABLE [TestTable] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[FirstName] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
[LastName] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
[Country] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[Note] [nvarchar ......
ʹÓÃ×Ô¶¨Òå±íÀàÐÍ£¨SQL Server 2008£©
http://tech.ddvip.com 2009Äê09ÔÂ19ÈÕ À´Ô´£º²©¿ÍÔ° ×÷Õߣº³ÂÏ£ÕÂ
¡¡¡¡ÔÚ SQL Server 2008 ÖУ¬Óû§¶¨Òå±íÀàÐÍÊÇÖ¸Óû§Ëù¶¨ÒåµÄ±íʾ±í½á¹¹¶¨ÒåµÄÀàÐÍ¡£Äú¿ÉÒÔʹÓÃÓû§¶¨Òå±íÀàÐÍΪ´æ´¢¹ý³Ì»òº¯ÊýÉùÃ÷±íÖµ²ÎÊý£¬»òÕßÉùÃ÷ÄúÒªÔÚ ......
ÎÄÕµ¼º½ SQL Server 2005 ѧϰ±Ê¼ÇϵÁÐÎÄÕµ¼º½
ÔÚSQl 2005 For XMl ¼òµ¥²éѯ(Raw£¬Auto£¬Pathģʽ)(1) ÀïÎÒÃÇ˵Á˹ØÓÚPath£¬RawºÍAutoģʽµÄÓ÷¨£¬ÆäʵÀïÃæ²»½ö½ö ÊÇÕâЩ¼òµ¥µÄ²Ù×÷£¬»¹ÓÐһЩÆäËüµÄÌØÐÔ£¬±ÈÈç˵Type»òOpenXml·½·¨£¬sp_xml_preparedocument´æ´¢¹ý³Ì µÈÕâЩÔö¼ÓµÄ¶«¶«£¬ÎÒÃÇÀ´Ò» ......
insert into OPENROWSET('MICROSOFT.JET.OLEDB.4.0'
,'Excel 8.0;HDR=YES;DATABASE=c:\test.xls',sheet1$)
select * from ±íÃû
Èç¹ûÊÇÉú³Éexcel時ÓÃbcp
--µ¼³ö²éѯµÄÇé¿ö
EXEC master..xp_cmdshell 'bcp "SELECT au_fname, au_lname from pubs..authors ORDER BY au_lname" queryout "c:\test.xls" /c -/S"·þÎ ......