Note: Examples shown here were tested on Microsoft SQL Server 2008.
Microsoft SQL Server 2008 Tips/Tricks
For all examples shown here, the database if not explicitly shown is named
Show all columns of a database table
Examples (equivalent results):
SELECT name FROM sys.columns WHERE object_id = OBJECT_ID('dbo.Users')
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Services.dbo.Users'
In my case I had drilled down using the
Microsoft SQL Server Management Studio prior to running the queries, so the tables could have simply been specified as
Users with the same result.