Click here to Skip to main content
12,511,553 members (51,616 online)
Rate this:
 
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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160929.1 | Last Updated 1 Jan 2013
Copyright © CodeProject, 1999-2016
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