sending data to an MS-SQL dbase

  • Thread starter Thread starter Kamal Hussain
  • Start date Start date
K

Kamal Hussain

I know how to extract data from an SQL database and load
it into Excel. How can I sen data into the SQL tables ?
 
This might be a help for getting data to and from Excel and Access: It
includes examples of using variables in SQL queries.
http://www.bygsoftware.com/examples/sql.html

Or you can get there from the "Excel with Access Databases" section on page:
http://www.bygsoftware.com/examples/examples.htm

It demonstrates how to use SQL in Excel's VBA to:

* create a database,
* create a table and add data to it,
* select data from a table,
* delete a table,
* delete a database.

DAO and ADO files available.

You can also download the demonstration file called "excelsql.zip".

The code is open and commented.


--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"
 
I assume therefore you know how to run a query and have the necessary
permissions. To update a SQL Server database using data from an Excel
workbook, connect to the workbook using the MS Jet OLEDB data provider
and execute a SELECT..INTO query which specifies the SQL Server
connection string, using its ODBC driver (sorry, don't know of a way
to use OLEDB), in the query e.g.

SELECT MyCol1, MyCol2
INTO [ODBC;Driver={SQL
Server};SERVER=MyServer;DATABASE=MyDatabase;UID=;Pwd=;].MyNewTable
FROM [MyWorksheet$]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top