I have a stored procedure that does this...
CREATE PROCEDURE spGetRegion @postcode nvarchar(10)
AS
SELECT capt FROM REGION_DATA
where POSTCODE = @postcode
go
This means I can run
exec spGetCounty @postcode = 'rh12'
and it returns an area, such as "south east'
Is it possible to include the results of a stored procedure like this in a select statement. for example
SELECT
FIRST_NAME
, LAST_NAME
, POSTCODE
, << NEED TO INCLUDE RESULTS OF STORED PROCEDURE HERE PASSING IN POSTCODE
FROM PEOPLE
So something like
SELECT
FIRST_NAME
, LAST_NAME
, POSTCODE
, exec spGetCounty @postcode = 'rh12' << THIS BIT DOESN'T WORK !!
FROM PEOPLE
any ideas?