I'm trying to write a stored procedure that will return a specific value base on two input parameters. The issue is trying to make one of the parameters refer to a column.
Here's my table:
CityID CityName London Paris
----------- -------------------- --------------------------------------- --
1 London 0 60
2 Paris 50 0
3 Berlin 90 60
4 Madrid 150 90
5 Dublin 30 80
6 Rome 75 88
Is it possible to write a stored procedure along the lines of:
CREATE PROCEDURE Price (@city1, @city2)
AS
SELECT @city2
FROM dbo.MyTable
WHERE CityName = @city1