Function will return a value of 'ColumnName'
Select Field1 AS [dbo].GetDisplayName('Parm1','Parm2')
from [TABLENAMEHERE]
Should return:
ColumnName
-----------------
Field1
Field1
Can anyone tell me if this is possible or a better way to do this?
--
Andrew J. Kelly SQL MVP
Solid Quality Mentors
"Rick" <rfe...@newsgroups.nospam> wrote in message
news:%23cVX$ugFKH...@TK2MSFTNGP03.phx.gbl...
As Andy says, you will end up with dynamic SQL, unless all possible
columns have the same data type, in which case you could use a CASE
expression.
--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
As Andrew mentioned, have a look at dynamic sql.
Good luck, Bernd
"Rick" <rfe...@newsgroups.nospam> schrieb im Newsbeitrag
news:%23cVX$ugFKH...@TK2MSFTNGP03.phx.gbl...