Hi,
I have the following query:
create proc [dbo].GetCustById
as
DECLARE @sql nvarchar(500)
DECLARE @Param nvarchar(200)
SET @sql = 'select @columnName from customer where custId = @custId'
SET @Param = N'@columnName varchar(10), @custId int'
EXEC sp_executesql @sql, @Param , @columnName = 'Address1', @custId = '42'
But it always return a string "Address1" instead of the value of Address1 column. Anyone can help?
thanks