Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listing tables 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
I am learning sql. can anyone tell me how to excecute a stored procedure(user defined). also how to I write a script to return the names of tables in a database?
 
Hiya,

To execute a stored procedure, it is just

EXEC database_name.owner.stored_procedure_name

If you are in the database that the stored procedure is in, and are aliased as dbo, then you can just do

EXEC stored_procedure_name

To list all tables in a database, you need :

USE database
GO
SELECT name FROM sysobjects WHERE type = 'U'
GO

This will list the names of all user created databases.

Tim

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top