Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Dynamically changing column alias (T-SQL)?

Author  Topic 

odeborne
Starting Member

1 Post

Posted - 2001-05-25 : 05:45:21
Dear All,

I'm stuck with this problem:

First, I would like to change dynamically the alias for each column returns by my stored proc.

I've tried this but it didn't work:

DECLARE @ColAlias sysname

SET @ColAlias = 'test'

SELECT field1 AS @ColAlias FROM table

Second, I've written a user defined function which returns a string (column alias) according to the input value (field name), so I can centralize all the alias. So, I would like to do:

SELECT field1 AS MyFunction('field1') FROM table

Is it possible, please help!!!

Thanks, Olivier.



   

- Advertisement -