jeudi 23 juillet 2015

SQL Server column alias has no effect

I'm trying to rename a column name in order to aid mapping data from this database into another for a data push.

What I need to do is change the name of StdType to IncomeType, although no matter what I try it simply does not change the column name in the result.

This is my SQL query:

SELECT
    'AA' + CAST(ClientID AS VARCHAR) AS AAID, 
    Description, 
    Convert(Money,Amount)/100 AS Amount, 
    Note, 
    StdType FROM [Finstat_Income] AS IncomeType
INNER JOIN #Assessments A
    ON 'AA' + CAST(ClientID AS VARCHAR) = A.AAID

#Assessments is a temporary table which does exist and works for my other queries.

Finstat_Income is a table and not a view. I've also tried the query with and without square brackets but there is no difference.

The resulting output is headed as:

AAID | Description | Amount | Note | StdType
...

Where my desired output is:

AAID | Description | Amount | Note | IncomeType

Aucun commentaire:

Enregistrer un commentaire