I have a Microsoft SQL database and I want to know what columns and types it has. I'd prefer to do this through a query rather than using a GUI like Enterprise Manager. Is there a way to do this?
From stackoverflow
-
There are a few methods to get metadata about a table:
sp_help @tablenameWill return several result sets, describing the table, it's columns and constraints.
The
INFORMATION_SCHEMAviews will give you the information you want, though unfortunately you have to query the views and join them manually. -
You can use the sp_columns stored procedure:
exec sp_columns MyTableJedidja : Thanks - I was about to post the same question with T-SQL instead of MSSQL. -
Just in case you don't want to use stored proc, here's a simple query version
select * from information_schema.columns where table_name = 'aspnet_Membership' order by ordinal_position -
The trick given by "Vincent Ramdhanie" works perfectly fine. Thanks Vincent for sharing it.
0 comments:
Post a Comment