Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Suggest me to import data from excel

Author  Topic 

Hilary
Starting Member

1 Post

Posted - 2011-04-28 : 03:26:04
How to import data from Ms-Excel to SQL Server database

Ahanthem Hilary Singh
Khurai Thoidingjam Leikai,
Imphal East,
Pin No - 795010

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2011-04-28 : 03:31:40
Right Click on target database ---> Tasks ---> Import Data
On first "Data Source" page, select MS Excel as datasource... click browse to open your source excel file ...move next and on 5th page of wizard select your desired sheet and follow the wizard

--------------------------
http://connectsql.blogspot.com/
Go to Top of Page

raghuveer125
Constraint Violating Yak Guru

285 Posts

Posted - 2011-04-28 : 03:31:46
CREATE EXCEL FILE IN C DRIVE AND NAME DEMO.xls
demo.xls data
"
cstid namea amount postcode statuss
123 XYZ 23$ XXYY Active
124 XYZ 23$ XXYY Active
124 XYZ 23$ XXYY Active
"
and save
next run this

SELECT * into #temp FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\demo.xls', [Sheet1$])--This data will import in --#temp table


select * from #Temp
----------
SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=c:\Demo.xlsx', [Sheet1$])

Raghu' S
Go to Top of Page
   

- Advertisement -