|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Wednesday, April 20, 2011 2:30 AM
Points: 19,
Visits: 43
|
|
plz..........help any one .....how to import data from excel file to sql server database
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, July 14, 2011 3:53 AM
Points: 3,
Visits: 44
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- IMPORT FROM EXCEL TO TABLE ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Select * into XLSheet1 from OPENROWSET ('Microsoft.jet.OLEDB.4.0','Excel 8.0; database=C:\Latest.xls;', 'Select * from [Report$]')
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- EXPORT FROM TABLE TO EXCEL ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
INSERT INTO OPENROWSET ('Microsoft.jet.OLEDB.4.0','Excel 8.0; database=C:\Latest.xls;', 'Select * from [Report$]') select top 10 * from DataReport
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 5:30 AM
Points: 870,
Visits: 522
|
|
Right click on the Database. Select Tasks-> Import data
The wizard will take U step by step.
Select excel as Datasource.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Friday, January 20, 2012 3:42 PM
Points: 42,
Visits: 21
|
|
Yup, easy solution is just Select destination database; right click go to Tasks -> Import Data.
A wizard will show up to import and that give option to import from Excel. Select Microsoft Excel in DataSource. Select Excel file you need to import.
Just follow the wizard steps. If you have long text in any column of Excel file; better to map the Source Column from Excel and Destination in DB table. Change the type properly that can parse Excel column's value else it will throw error.
Enjoy!
Regards, Himanshu
|
|
|
|