When writing stored procedures or views, I always create them in Visual Studio (2005/2008) and then run them on a specified database. When using "SELECT *", it is compact, but obviously does not help you find the columns of the table or view.
When using the IDE, I added a new SQL Script for Stored Procedures, and then I typed:
and a blue box surrounded the statement. I right-clicked -> Design SQL Block.
The designer then listed all of the column names for me, and when clicking OK, instantly put them back into the SQL script I was creating!
SELECT CustomerID, CompanyName, ContactName, ContactTitle,
Address, City, Region, PostalCode, Country, Phone, Fax
FROM Customers
For the table I was using, this list over 60 columns for me!
So if you want a quick way of listing all of the column names for table of view:
- Add a database project to your site (if you haven't already done so)
- Right click Queries -> Add SQL Script
- Choose Stored Procedure Script
- Type your SELECT * From XYZ statement
- Right click -> Design SQL Block
- Click OK.
The designer will be updated with the new query.