SQL String value

imfarhan

Board Regular
Joined
Jan 29, 2010
Messages
123
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 currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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

Forum statistics

Threads
1,215,530
Messages
6,125,353
Members
449,220
Latest member
Edwin_SVRZ

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