This script is great when you are searching for a field in a database with a lot of tables or tables with many fields. It lists every table and field in a SQL Server database. Just run it in Query Analyzer and select the database you want it to return info on in the drop down list at the top of Query Analyzer. This has saved me a lot of time. Some of our databases have over 300 tables.
--List of Table and field Names
SELECT
table_name,
column_name,
data_type,character_maximum_length as width
FROM information_schema.columns
ORDER BY table_name, ordinal_position
No comments:
Post a Comment