I have tried running this for three days with no success,any ideas anyone??
CREATE PROCEDURE spGetThisTableField --@ReturnVal as int output,
@strTableName sysname, --Recipes
@strCompareFld as char(50), --RecipeKey
@strSearchValue as int, --9
@strFieldToReturn as char(50) --PackCodeKey
--Select Recipes.packCodeKey from Recipes WHERE Recipes.RecipeKey = 9
AS
declare @SQLCommand VarChar(200)
Set @SQLCommand =('Select '+@strTableName+'.'+@strFieldToReturn+' from '+@strTableName+
'where '+@strTableName+'.'+@strCompareFld+' = 9') --+@strSearchValue))
EXEC (@SQLCommand)
GO
CREATE PROCEDURE spGetThisTableField --@ReturnVal as int output,
@strTableName sysname, --Recipes
@strCompareFld as char(50), --RecipeKey
@strSearchValue as int, --9
@strFieldToReturn as char(50) --PackCodeKey
--Select Recipes.packCodeKey from Recipes WHERE Recipes.RecipeKey = 9
AS
declare @SQLCommand VarChar(200)
Set @SQLCommand =('Select '+@strTableName+'.'+@strFieldToReturn+' from '+@strTableName+
'where '+@strTableName+'.'+@strCompareFld+' = 9') --+@strSearchValue))
EXEC (@SQLCommand)
GO