SQL String value

imfarhan

Board Regular
Joined
Jan 29, 2010
Messages
125
Office Version
  1. 2016
Platform
  1. Windows
Hi,
I have a table called SQLTbl, keeps all SQL of my reports

Field Name Value

QueryCode: D-X1
QueryName: EmployList query
SQLQuery: SELECT empno,ename,job..........

I would like to pulls only string/tables values between "FROM" clause and "WHERE" caluse
Eg:-


Quote:
<TABLE cellSpacing=0 cellPadding=6 width="100%" border=0><TBODY><TR><TD class=alt2 style="BORDER-RIGHT: 1px inset; BORDER-TOP: 1px inset; BORDER-LEFT: 1px inset; BORDER-BOTTOM: 1px inset">Select empno,ename,job, deptno,dname
FROM emp, dept innerjoin dept.deptno.emp.deptno
WHERE dept.dname = "XYZ" </TD></TR></TBODY></TABLE>
So, from the above query I would like to pull only string value b/w FROMm and WHERE as given below
"FROM emp, dept innerjoin dept.deptno.emp.deptno"

I tried

SELECT INSTR(SQLQuery,"FROM") ????
FROM SQLTbl

I hope it does make sense to you

I thiink I have to use INTR or any other function but don't know how. I would appreciate your help.
Farhan
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Save yourself the hassle. Go to Access MVP Armen Stein's website and download the SQL Tools. He has a set of functions in a standard module which will basically let you do what you need (including replace functions where you can replace the where clause or the select clause or the grouping, etc.).
 
Upvote 0

Similar threads

Forum statistics

Threads
1,224,596
Messages
6,179,807
Members
452,944
Latest member
2558216095

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