0

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.

Thom A
  • 88,727
  • 11
  • 45
  • 75
  • SSMS (Management Studio) and Visual Studio have this built-in. Both will show you the table visually, or you can script it into a CREAT TABLE command, if you wish. – RBarryYoung Mar 19 '23 at 13:57

1 Answers1

1

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.

David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67
  • 1
    Adding one can select an object name in an SSMS query window and press the alt-F1 shortcut key to execute `sp_help` on the object. – Dan Guzman Mar 19 '23 at 13:59