Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. sql statements

sql statements

Scheduled Pinned Locked Moved Database
databasequestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pnpfriend
    wrote on last edited by
    #1

    what is the sql statement to get the name of all tables exiting in a database thank you

    H D 2 Replies Last reply
    0
    • P pnpfriend

      what is the sql statement to get the name of all tables exiting in a database thank you

      H Offline
      H Offline
      Henrik Stuart
      wrote on last edited by
      #2

      USE db;
      GO

      SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
      WHERE TABLE_TYPE = 'BASE TABLE';

      For instance. Presuming, of course, you're talking about MSSQL Server. -- Henrik Stuart (http://www.unprompted.com/hstuart/)

      1 Reply Last reply
      0
      • P pnpfriend

        what is the sql statement to get the name of all tables exiting in a database thank you

        D Offline
        D Offline
        dishanf
        wrote on last edited by
        #3

        SELECT * FROM sysobjects WHERE type = 'U' D!shan

        A 1 Reply Last reply
        0
        • D dishanf

          SELECT * FROM sysobjects WHERE type = 'U' D!shan

          A Offline
          A Offline
          Arjan Einbu
          wrote on last edited by
          #4

          Use the INFORMATION_SCHEMA approach that Henrik Stuart described, since MS can and probably will change the structures many of its system tables in future versions of SQL Server. The results of using the INFORMATION_SCHEMA viewvs are guaranteed to stay the same in all never versions of SQL Server.


          Have a look at my latest article about Object Prevalence with Bamboo Prevalence.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups