Results 1 to 4 of 4

Thread: SQL Program/Function Detecting Tables by Name

  1. #1
    Join Date
    Jul 2005
    Location
    Edinburgh
    Posts
    2

    SQL Program/Function Detecting Tables by Name

    Hello All,

    I am looking for some SQL function which would list all the tables in a DB starting with some specific names e.g

    Database Name: DB_Employee
    Table1 : tbl_for_employer
    Table2: tbl_for_salaries_JUN_05
    Table3: tbl_for_current_orders
    Table4: tbl_for_salaries_JUL_05
    Table5: tbl_for_salaries_AUG_05

    From above DB i want some program to show me all the list of tables starting with 'tbl_for_salaries'.

    All suggestions invited!


    thanks,
    Umer

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    select name
    from sysobjects
    where name like 'tbl_for_salaries%'

  3. #3
    Join Date
    Sep 2002
    Posts
    5,938
    That assumes you use ms sql server.

  4. #4
    Join Date
    Jul 2005
    Location
    Edinburgh
    Posts
    2
    Yes it is for MS SQL Server.

    Thanx skhanal, thats exactly what i was looking for.

    Cheers!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •