May 17, 2005 at 2:50 am
how to find the name of tables involved in a query?
ex select 1 from a inner join b on a.1 = b.1
result a,b
May 17, 2005 at 5:58 am
What do you mean exactly? Is this a query that is stored somewhere and you want to parse it?
May 17, 2005 at 7:31 am
Yes i have bunch of queries in a table.
From that sqlquery field, i want to find out the tables involved in that query.
May 17, 2005 at 8:24 am
Ok, then it involves doing text parsing of those queries. That is generally something that I personally avoid doing in T-SQL, since it is not really very good at it. If you want to give it a try you should look up CHARINDEX and SUBSTRING functions in Books Online.
May 18, 2005 at 4:18 am
Using string manipulation i already tried, and it works fine, my doubt is whether sql server internally has any function to find it out like set parseonly.
May 18, 2005 at 5:04 am
But SET PARSEONLY requires that you execute a statement (even though it will only be parsed and not executed), and it does not return any resultset regarding which tables are used. Afaik and the way I understand your question, you need to parse the strings yourself.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply