SELECT — Returning specific columns — Parv The IT Geek

There are many times where returning all the data held within all the columns in a table are unnecessary and inefficient.

For example.

SELECT * FROM HumanResources.Department

If you expand out the HumanResources.Department then you will get a list of the columns as well as some information on the columns.

To get only the DepartmentID and Name columns the following query would be needed.

SELECT DepartmentID,Name FROM HumanResources.Department

Originally published at https://parvtheitgeek.com on January 4, 2014.

Advertisement

Published by Parvinder Nijjar

I blog at ParvTheITGeek.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: