Have table name wants to know DB name

  • I have a table name and I want to know which database contains that table. How do I find out?

    Thanks.

  • Run a query against the information_schema.tables view in each database on the server to find out the one(s) it is in.

  • you can run the following query :

    EXECUTE sp_msforeachdb 'select * from ?.information_schema.tables where table_name = ''articles'''

  • Thank you, that works.

  • select * from information_schema.tables where table_name = 'articles'

    Error starting at line 1 in command:

    select * from information_schema.tables where table_name = 'articles'

    Error at Command Line:1 Column:33

    Error report:

    SQL Error: ORA-00942: table or view does not exist

    00942. 00000 - "table or view does not exist"

    *Cause:

    *Action:

    i am running the above query in SQLDeveloper tool.

    plz give alternate solution.

  • I'm guessing one or more of your databases have a case-sensitive collation. The name of the INFORMATION_SCHEMA schema and the views within it are upper case.

    John

  • NO IT IS ALSO NOT WORKING>>>SAME ERROR AGAIN

    :crying:

    but thanks for ur respond....

    chandan

  • i am running the above query in SQLDeveloper tool.

    What happens if you run it in SSMS? Also, that error message does not look like one generated by SQL Server. Are you sure you're running the query against a SQL Server database?

    John

  • no i m running it against ORACLE database

    chandan

  • Case solved. You need to post on an Oracle forum.

    John

  • sry,thats not my ans.

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply