Click here to Skip to main content
15,911,315 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

how to find table names in given query in sql sqlserver

thanks
Posted
Comments
[no name] 6-Dec-11 1:50am    
please explain and give example. we dont get your question
D K N T H 6-Dec-11 1:52am    
incomplete details. please provide specific question and if possible provide sample data. thanks
K N R 6-Dec-11 1:55am    
1) select id from tablename1 t1,tablename2 t2 where t1.id=t2.id

2) select * from tablename1 t1 inner join tablename2 t2 on t1.id=t2.id

1 solution

if you want only tables names
just try this
SQL
SELECT '['+SCHEMA_NAME(schema_id)+'].['+name+']'
AS SchemaTable
FROM sys.tables
 
Share this answer
 
Comments
K N R 6-Dec-11 2:02am    
i want only given query table names

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900