vendredi 29 juillet 2016

Using a variable to name query results column

Is there a way to use a variable to name a column in SQL query results? My example below gives an "Incorrect syntax" error?

declare @ColumnName varchar(100) = 'Column 1'

Select CustomerNumber as @ColumnName
  from Customers

Aucun commentaire:

Enregistrer un commentaire