AS — Rename output columns — Parv The IT Geek

Sometimes when you run a query you may want to rename the columns in the results. This is quite a simple process within SQL.

First you will need to know the source column names.

For example

USE AdventureWorks

SELECT * FROM [HumanResources].[Department]

Or you can open up the table which gives the column names.

You can change the name of the column by using the below SYNTAX

[ SourceColumn Name] AS [DesiredOutputName]

SELECT [DepartmentID] AS ID,

[Name] AS [Department Name],

[GroupName] AS [Function],

[ModifiedDate] AS LastChangeDate

FROM [HumanResources].[Department]


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

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 )

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: