如何将Excel文件转换为SQL Server2005中的数据库?

如何将Excel文件转换为SQL Server2005中的数据库?

问题描述:



我是金奈的Mohan Kumar.

我怀疑将excel文件转换为数据库表.
请任何知道如何执行此操作的人回复给我.

Mohan

Hi,

I am Mohan Kumar from Chennai.

I have doubt for convert the excel file into database table.
Please can anyone who knows how to do this reply to me.

Mohan

尝试此链接

链接1:[ ^ ]

链接2:[ ^ ]
try this link

Link 1:[^]

Link 2:[^]


您有两种方法.

1.简单易用的方法,即使用SQL Server提供的导入向导.

2.使用OPENROWSET命令.

You have two ways of doing it.

1. The easy and simple way i.e to use the Import Wizard provided by the SQL Server.

2. Use the OPENROWSET command.

INSERT INTO [tableName] ([C1], [C2], [C3], [C4])  
SELECT DB.[C1], DB.[C2], DB.[C3], DB.[C4] 
FROM OPENROWSET  ('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\testDB.xls;HDR=YES', 'select * from [Sheet1

select *中选择* br/>


') AS DB;




我个人更喜欢第二种方法.虽然看起来没有什么是完成它的最佳方法.

BR//
Harsha Narayana




I personally prefer the second method. Though it looks little complecated its the best way of doing it.

BR//
Harsha Narayana