Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
sql query to copy tables & stored procedures schema into another database and not tables data?
Posted
Comments
Corporal Agarn 29-Aug-11 9:41am    
Do you have to use T-SQL or can you use the wizard to copy tables? If you are doing all why not do a backup and restore?

1 solution

Hi,

Check this out:

Information Schema Views (Transact-SQL)
T-SQL: List of information_schema views

SQL
--Tables
SELECT * FROM INFORMATION_SCHEMA.TABLES

--Columns
SELECT * FROM INFORMATION_SCHEMA.COLUMNS

--Stored procedures
SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'PROCEDURE'

--Functions
SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'FUNCTION'


You can use
SQL
SP_HELPTEXT Procedure_Or_Function_Name
to get the contents of the procedures and functions, there's maybe a better way though.

Hope it helps!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900