Today onwards on daily basis, I decided to post the Sql Query to access the SharePoint Databases. To know more about the databases in Sharepoint , check my SharePoint Databases Post.
To retrieve all lists from the database, use the following query,
select AllLists.tp_Title as ‘List Title’,webs.Title as ‘Web Title’
from dbo.AllLists as AllLists
inner join dbo.Webs as webs
order by webs.Title
dbo.AllLists Table contains all the lists available in WebApplication Level *
dbo.Webs Table Contains all the webs or sites available in WebApplication Level *
*If the Database configured for SiteCollection, then the table only contains the datas for SiteCollection Level.