import data from excel file to sql server database

  • plz..........help any one .....how to import data from excel file to sql server database

  • ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    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

  • Right click on the Database. Select Tasks-> Import data

    The wizard will take U step by step.

    Select excel as Datasource.

  • 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

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply