Click here to Skip to main content
11,640,626 members (60,141 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
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 31-Dec-12 19:30pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This link can help you out what you are looking for:
http://support.microsoft.com/kb/321686[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Here you go

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.
  Permalink  
v2

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

  Print Answers RSS
0 Mika Wendelius 370
1 OriginalGriff 205
2 Afzaal Ahmad Zeeshan 130
3 CPallini 125
4 DamithSL 105
0 Mika Wendelius 370
1 OriginalGriff 205
2 CPallini 125
3 DamithSL 105
4 Afzaal Ahmad Zeeshan 70


Advertise | Privacy | Mobile
Web03 | 2.8.150731.1 | Last Updated 1 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100