• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Using Replace function when Querying Workbook/sheets ADODB (ACEODBC driver)

Shreedhar

New Member
Hi Gurus, Need suggestion on alternative to REPLACE function, ODBC excel driver errors
Undefined function REPLACE when it is used in a SQL QUERY statement.

Can anyone suggest any alternative to this issue, also what are the valid functions that are supported in sql statements.

Thanks for your time.

Regards, Shreedhar
 
ODBC has limited set of functions that you can use depending on engine used. Can't recall if there was comprehensive list for querying Excel.

Use "Case When x Then y Else z End" type of statement.
 
Let's have a look at some of the code you're using and where it errors.
If you're trying to use the vba REPLACE function directly in a SQL query I cant see it working, but with the right combination of quote marks and variables it's usually possible to create a SQL query on the fly.
 
Let's have a look at some of the code you're using and where it errors.
If you're trying to use the vba REPLACE function directly in a SQL query I cant see it working, but with the right combination of quote marks and variables it's usually possible to create a SQL query on the fly.

I use the REPLACE function in the SQL query itself, My earlier workaround was to using replace range on the cell ranges after the RecordSet is published.

*** Using Single quote instead of double solves the issue. ***

e.g. code
Conn.Open sconnect

sSQLSting = "SELECT replace([TOPPATH], '/', '%') as TOPPATH1, ASSIGNMENT_NAME From [Sheet1$]"


Thanks
 
ODBC has limited set of functions that you can use depending on engine used. Can't recall if there was comprehensive list for querying Excel.

Use "Case When x Then y Else z End" type of statement.

Thanks Chihiro...

*** Using Single quote instead of double solves the issue. ***

e.g. code
Conn.Open sconnect

sSQLSting = "SELECT replace([TOPPATH], '/', '%') as TOPPATH1, ASSIGNMENT_NAME From [Sheet1$]"

I use the REPLACE function in the SQL query itself, My earlier workaround was to using replace range on the cell ranges after the RecordSet is published.
 
Back
Top