I have sql stored procedure code in a string variable in Excel VBA, I am trying to get list of all table names used in this stored procedure. So each table starts with a schema name Prop.Table1 , Prop.Table2. I am doing a instr and trying to get the occurrence of Prop but how do I get the full name like Prop.Table1 , I cannot just use a mid because the table name would not always be followed by a space (it can be a line feed or space)
Input:
create proc test
as
begin
select * from Prop.Table1
join Prop.Table2 p
on Prop.Table1.col1=p.col1
end
Output:
Prop.Table1
Prop.Table2
I don't mind getting duplicate table names in my output.