I've just been granted access to a SQL Server data warehouse and I'm trying to get to grips with sqlcmd. Coming from a Postgres/psql background, I'm used to being able to quickly look up a table definition using short cuts like
The equivalent I've found so far is
\d+ [tablename]
. This produces a nice, single screen vertical summary of the table columns, datatypes and constraints. Something like this:

EXEC sp_help 'table_name'
but this prints an unreadable, multi-page mess. Is there a way to clean up this output? Is there a better TSQL command that will give a simple table summary?
Asked by Matt
(291 rep)
Jul 31, 2023, 09:14 PM
Last activity: Jul 31, 2023, 09:24 PM
Last activity: Jul 31, 2023, 09:24 PM