MS SQL Server Concepts and Programming Question: Download MS SQL Server PDF
How To Select Some Specific Columns from a Table in a Query in MS SQL Server?
Answer:
If you want explicitly tell the query to return some specific columns, you can specify the column names in the SELECT clause. The following select statement returns only three columns, "id", "created" and "url" from the table "ggl_links":
<pre>
SELECT id, created, url FROM ggl_links
id created url
101 2006-04-30 www.globalguideline.com
102 2007-05-19 www.globalguideline.com/html
103 2007-05-19 www.globalguideline.com/sql
</pre>
<pre>
SELECT id, created, url FROM ggl_links
id created url
101 2006-04-30 www.globalguideline.com
102 2007-05-19 www.globalguideline.com/html
103 2007-05-19 www.globalguideline.com/sql
</pre>
Previous Question | Next Question |
How To Select All Columns of All Rows from a Table with a SELECT statement in MS SQL Server? | How To Select Some Specific Rows from a Table in MS SQL Server? |