Wednesday, June 24, 2009

select all table name all field name in one database

select all table name all field name in one database


use your_db_name
go

SELECT
o.name, c.name, t.name
--o.name
FROM sys.objects o
JOIN sys.columns c ON o.object_id = c.object_id
JOIN sys.types t ON c.system_type_id = t.system_type_id
WHERE
t.name not like 'sysname'
and o.name not like 'sys%'
and o.name not like 'queue_messages%'

--group by o.name
ORDER BY o.name
go

No comments: