Solved

getting table names

Posted on 2008-10-01
8
169 Views
Last Modified: 2010-03-19
It it the same in MS SQL, i need to get all my tables names and data would  SHOW TABLES work in MSSQL
0
Comment
Question by:pigmentarts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 16

Expert Comment

by:brad2575
ID: 22613057
you mean something like this:

SELECT     distinct(TABLE_NAME)
FROM         INFORMATION_SCHEMA.COLUMNS
0
 
LVL 4

Expert Comment

by:aerion85
ID: 22613064
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 22613106
brad2575 would that get all the tables in the database as it looks like i would have to know the table names, what if i did not knowa the names and wanted to return a list of them?

aerion85: thats MYSQL not MS SQL right
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Expert Comment

by:brad2575
ID: 22613150
yes that would get a list of ALL the distinct/unique table names.  If you wanted to search to see if a specific table existed or not you would have to add that to the where clause.
0
 
LVL 4

Expert Comment

by:aerion85
ID: 22613177
oh damn, i'm sorry;o
0
 
LVL 17

Expert Comment

by:Shanmuga Sundaram
ID: 22613232
please try this helps

select name from sysobjects where type='u' and name like '%yourtablename%'
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 22613251
sorry, so does that mean if i just wanted to return a list of tables names without first knowing what they are called, then this would do?
0
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 22613298
select * from sys.tables
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question