473,473 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do i grab a simple list of SQL Server views, tables or sprocs?

I need just the names of tables, views and sprocs within a SQL Server
database. What's the easiest way to do this?
Jul 20 '05 #1
3 24890
[posted and mailed, please reply in news]

Kofi (ko*******@gmail.com) writes:
I need just the names of tables, views and sprocs within a SQL Server
database. What's the easiest way to do this?


SELECT name FROM sysobjects WHERE xtype = 'U' -- Tables
SELECT name FROM sysobjects WHERE xtype = 'V' -- Views
SELECT name FROM sysobjects WHERE xtype = 'P' -- Stored Procedures


--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #2
"Kofi" <ko*******@gmail.com> wrote in message
news:5c**************************@posting.google.c om...
I need just the names of tables, views and sprocs within a SQL Server
database. What's the easiest way to do this?


SELECT table_name AS object_name,
table_schema AS schema_name,
table_type AS object_type
FROM INFORMATION_SCHEMA.TABLES
UNION ALL
SELECT routine_name AS object_name,
routine_schema AS schema_name,
routine_type AS object_type
FROM INFORMATION_SCHEMA.ROUTINES
WHERE routine_type = 'PROCEDURE'
ORDER BY object_type, schema_name, object_name

--
JAG
Jul 20 '05 #3
Thanks Erland,

I was having a thick moment. I've used those SELECT statements
countless times before. Shame I was looking at the Master database
rather than the database I was in fact interested in.

But now I've a nice alternative below though :)

-- Kofi

Erland Sommarskog <so****@algonet.se> wrote in message news:<Xn*********************@127.0.0.1>...
[posted and mailed, please reply in news]

Kofi (ko*******@gmail.com) writes:
I need just the names of tables, views and sprocs within a SQL Server
database. What's the easiest way to do this?


SELECT name FROM sysobjects WHERE xtype = 'U' -- Tables
SELECT name FROM sysobjects WHERE xtype = 'V' -- Views
SELECT name FROM sysobjects WHERE xtype = 'P' -- Stored Procedures

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Haris Bogdanovic | last post by:
I'm trying to implement chess server program so I started by implementing simple echo server. When client is trying to connect to the server everything works fine but when server tries to echo...
2
by: Gelo Ilzi | last post by:
I'm trying to implement a very simple http server with cgi functionality. The code is simple: import CGIHTTPServer, BaseHTTPServer httpd = BaseHTTPServer.HTTPServer(('',8000),...
0
by: Jesse Noller | last post by:
Hello - I am looking at implementing a simple SMTP server in python - I know about the smtpd module, but I am looking for code examples/snippets as the documentation is sparse. The server I...
0
by: List Server | last post by:
IMail List Server for Windows NT, Ipswitch, Inc. -------------------------------------------------------------------- Valid Commands are: To subscribe to a list, send a mail message to...
2
by: Maziar Aflatoun | last post by:
Hello, How do you get a list of all tables in a sql server database using C#? Thanks Maz.
1
by: timmso | last post by:
I am trying to build a simple asp.net project. What sort of control do I need to use to simply display a list of links in a table format? For example, let's say I have a database table: tblNames...
2
by: dbuchanan52 | last post by:
Hello, I am building an application for Windows Forms using. I am new to SQL Server 'Views'. Are the following correct understanding of their use? 1.) I believe a view can be referenced in a...
14
by: robert | last post by:
For testing purposes I'm looking for a simple DAV server - best a python thing serving a folder tree. Don't want to install/change/setup the complex apache dav .. Found PyDav...
0
by: Wolfgang Hercker | last post by:
I want to setup a simple web server (not a huge Apache or similar elephant) for which I can setup WAP/WML web pages for mobile phones. In other words it should be possible to add more MIME types...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.