How to view the schema of a table in SQL SERVER? [duplicate]

puruo6ea  于 2023-03-22  发布在  SQL Server
关注(0)|答案(1)|浏览(163)

This question already has answers here:

How can I show the table structure in SQL Server query? (10 answers)
Closed 2 days ago.

In MySQL it's pretty easy, just run DESC tablename; query and it shows the structure but doesn't work for SQL Server.

I tried the same thing.

rt4zxlrg

rt4zxlrg1#

If you want to know all the basic metadata about a table, you can use sp_help

exec sp_help 'dbo.SomeTable'

There are other catalog views like sys.tables, sys.columns, etc that you can query for specific details.

But most people use a GUI like SQL Server Management Studio that will display the table metadata in a treeview, or schema diagram.

相关问题