Corect use of SQL

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,835
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi,

I want to query some data in my worksheet using SQL. This may not be a good idea as I recall some problem with memory leaks or similar, but regardless I can't get it working and would like to

I'm using ADODB and I have a working connection (to the current workbook) and can get results using "Select * From...". But I don't want "*" instead I want to specify a column (or columns)

A few things found online didn't work here e.g. "Select [Sheetname$.Col1]... or 'select [F1], [F2] etc.
Please, what is the correct working syntax after SELECT ?

Perhaps part of the problem is the extended header? I'm using ='Excel 8.0;HDR=NO'. There were conflicting answers found for HDR, some said use NO even if there are headers. And to use "IMEX=1" but that just seemed to make the connection take longer.

Any advice most welcome, thanks !
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I wondered that too, and if careful coding would minimise or prevent the problem. Maybe someone knows ?
 
Upvote 0
Thanks Rory, I wrote msg 12 before seeing your answer. So I guess not possible to use the current workbook. Pity.
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,283
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top