none
Excel 2007 Export to SQL Server 2008

    Question

  • I see a lot of examples on how to import sql server data to Excel using Data tab\Connections.  It's really easy to use.

    I want to export a couple of columns on Excel to a SQL Server 2008 table.  Is there something just as easy?  Do I have to write a VBA function?  If so, do you have a VBA function already written that could have?


    Mel
    Friday, June 17, 2011 8:22 PM

Answers

  • There are lots of methods to transfer data between Excel and a database.  You can using any language you want using Visual Studio (C++, C#, VBnet) or VBA.  You have a choice of putting the code in the server, in VBA in Excel, an excel addin, or even writing a spererate application that move the data between excel and the database.  Ort not use any code at all and create a query on the database the will import the data automatically.  The webpage section titled "Use Distributed Queries" is a SQL statement which you can place in a QUERY which will automatically import the data without any custom software.
    jdweng
    Sunday, June 19, 2011 11:39 AM
  • Thanks Joel for your information.

     

    Hi Mel,

    Here are two samples for your reference:

    Import Data from Excel to SQL Server

    This article mainly describes how to import data from an Excel sheet to the SQL Server, viewing the data from SQLServer using the Gridview control, and deleting data. In case the Excel sheet does not contain data (null values), those values are replaced by zero......... 

    Import/export Excel worksheet in ASP.NET (CSASPNETExcelImportExport)

    This CSASPNETExcelImportExport sample introduces how to import data from an 
    Excel spreadsheet to SQL Server and how to generate an Excel spreadsheet 
    with data from SQL Server.

     

    I hope this helps.


    Best Regards, Calvin Gao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Monday, June 20, 2011 8:57 AM

All replies

  • How to import data from Excel to SQL Server

    http://support.microsoft.com/kb/321686

    Friday, June 17, 2011 9:12 PM
  • I saw the same article reading on the linked server because I am trying to stay away from the VB 6 code example.   For example, you have the code SELECT * INTO XLImport1 FROM EXCELLINK...[Customers$].  What do I do with it?  Can I create a workbook connection and replace the command text?


    Mel
    Friday, June 17, 2011 9:42 PM
  • There are lots of methods to transfer data between Excel and a database.  You can using any language you want using Visual Studio (C++, C#, VBnet) or VBA.  You have a choice of putting the code in the server, in VBA in Excel, an excel addin, or even writing a spererate application that move the data between excel and the database.  Ort not use any code at all and create a query on the database the will import the data automatically.  The webpage section titled "Use Distributed Queries" is a SQL statement which you can place in a QUERY which will automatically import the data without any custom software.
    jdweng
    Sunday, June 19, 2011 11:39 AM
  • Thanks Joel for your information.

     

    Hi Mel,

    Here are two samples for your reference:

    Import Data from Excel to SQL Server

    This article mainly describes how to import data from an Excel sheet to the SQL Server, viewing the data from SQLServer using the Gridview control, and deleting data. In case the Excel sheet does not contain data (null values), those values are replaced by zero......... 

    Import/export Excel worksheet in ASP.NET (CSASPNETExcelImportExport)

    This CSASPNETExcelImportExport sample introduces how to import data from an 
    Excel spreadsheet to SQL Server and how to generate an Excel spreadsheet 
    with data from SQL Server.

     

    I hope this helps.


    Best Regards, Calvin Gao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Monday, June 20, 2011 8:57 AM
  • Hi Mel,

    Any update?


    Best Regards, Calvin Gao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 27, 2011 8:43 AM