Hi there all, been a long time reader, first question tho.Is it possible to make a sp where i submit the name of the column as parameter and get the value of that column as result?Maybe this code can show what i'm aiming for? (its the returning of the selected _value_ thats failing.
USE [companydatabase]GO/****** Object: StoredProcedure [dbo].[Sp_company_updateUserDb] Script Date: 01/09/2012 07:16:31 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[Sp_company_updateUserDb] @customerid varchar(30), @fieldname varchar(30)ASBEGIN SET NOCOUNT ON; declare @sqlquery varchar(100) -- Insert statements for procedure here set @sqlquery = 'SELECT ' + @fieldname + ' from usertable where customerid=' + @customerid execute(@sqlquery) print @fieldname END