Tags

, , ,


From time to time little things tend to puzzle us. Recently a request came to me to find out all the Tables in a Database which does not have any Views on them. Well, whenever any request comes to me my first instinct is to do little research in Google..but in this case I did not find anything useful code (I admit this is unusual)..so then I thought its time to use the grey cells in Brain and within minutes I wrote the query that gave me what I needed..Hhhmmm…Sometimes I think we unnecessary go to Google for help when we can solve the problems ourselves…Isn’t it???

Well here is the script I wrote for the same..Let me know if you have any other script like this.

SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME NOT IN
(
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEW_TABLE_USAGE
)
AND TABLE_TYPE=‘Base Table’

Thanks,

Subhro Saha

Advertisements