Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have created the excel sheet.in that sheet columns as follows;

Name DOB Mobileno Weddingday Email Active

100 of records are there in Excel.

i want to export that excel records into sqlserver 2005 table(DataBase)

Database columns as follows.

Name DOB Mobileno Weddingday Eamil Active

Table name as BirthDayWish.


Through query how to export the excel data in to sqlserver 2005 BirthDayWish table(Database).

it is possible by using query the excel data is export from excel to BirthDayWish Table.


plese help me.
Posted

This link can help you out what you are looking for:
http://support.microsoft.com/kb/321686[^]
 
Share this answer
 
Here you go

SQL
INSERT INTO [BirthDayWish] 
([Name],[DOB],[Mobileno],[Weddingday],[Email],[Active])
SELECT [Name],[DOB],[Mobileno],[Weddingday],[Email],[Active] FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=<excel file full path>', [<excel sheetname="">$])
GO


In the above query it is assumed that you are passing an excel file in office 2003 format(.xls). ExcelSheetName is the worksheet name (e.g. say Sheet1) in your excel workbook.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900