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.
Author |
Topic |
matiasgug
Starting Member
1 Post |
Posted - 2011-03-28 : 10:15:52
|
Hi,First, im not sure if this is the correct subforum in which to post this. Sorry if its the wrong one.I am writing this simple script. It gets data from two excel files and pastes them into a third one.By excel macro, it first copies the two excel files into a single one with two sheets. Then, by SQL i run a query to create a third one. Finally, i run an SQL query to get data from a table and paste it into the last one.When the query is "INSERT INTO ... VALUES ..." it works fine. But when it is "INSERT INTO ... SELECT * FROM ..." it pastes the data into one of the source tables instead of the new one. It even pastes it into the correct columns, but yet in a wrong table.I´m using this connection string: sConn = "Provider=Microsoft.ACE.OLEDB.12.0;" sConn = sConn & "Data Source=" & sTempFile & ";" sConn = sConn & "Extended Properties=Excel 12.0;" I have uploaded it. It contains the file with the macro and the two source files. You just need to unzip and edit the folder path in the very first lines of the macro SQLquery.xlsm. http://www.2shared.com/file/UoZ3CV72/SQL_excel_query.htmlI would really appreciate if someone could take a look. Im stuck at work with it and i need to get it done.Thanks! |
|
|
|
|