using InStrRev() and similar functions in Jet/ACE queries outside of Access

给你一囗甜甜゛ 提交于 2019-12-12 02:55:26

问题


Hia, I'm struggling a bit while forming some SQL queries. Currently I'm using:

InStrRev(TABLE.[_URL],"/")+1) AS OUTPUT

Given an input of a URL - I want to extract the last part eg:

www.url.com/some/text/here

Should return

here

There are always 3 slashes and while the snippet I posted works perfectly; only within access.

When I try and use this outside of access - I find errors - any advice on alternatives available to me?


回答1:


As you have discovered, SQL queries executed from within Access can use many VBA functions (like InStr() and InStrRev()) that are not natively supported by the Jet/ACE dialect of SQL. One of the most powerful aspects of Access' "extensions" to Jet/ACE SQL is that you can even write your own VBA functions and use them in Access queries.

Unfortunately, things can get a bit confusing when it comes to what functions are supported in "plain" Jet/ACE SQL because many of the names are the same. If we can use Left(), Right(), Mid(), etc. in queries against Jet/ACE databases executed outside of Access, then why not InStr() and InstrRev()? The answer is, unfortunately, "Just because.".

In your particular case I agree with Remou's comment that you'll probably just have to retrieve the entire column value in your query and then do the [equivalent of the] InStrRev()-related parsing afterward.



来源:https://stackoverflow.com/questions/15633533/using-instrrev-and-similar-functions-in-jet-ace-queries-outside-of-access

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!