Reputation: 139
I created a a stored procedure that returns a table that looks like this:
(No column name) (No column name)
2 4
The table has no name, but I'll call the procedure, "proc".
How would I change the name of the two columns that currently have no name, so basically:
ColA AnotherColumn
---------------------
2 4
Upvotes: 1
Views: 774
Reputation: 25112
You need to alias them. This happens in a few cases, but often with aggregate functions and sub-queries
select
sum(someColumn) as NewColumnName
,(select top 1 something From somewhere) ThisColumn --notice the AS is optional
from YourTable
Another method which isn't ANSI standard is using =
select
NewColumnName = sum(someColumn)
,ThisColumn = (select top 1 something From somewhere)
from YourTable
Upvotes: 3