Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to retrieve primary key column name for a given table
so i tried the solution
exec [sys].[sp_primary_keys_rowset] @table_name= 'TEMP_Decisions'
which is a system procedure
i want to know how to select one column from procedure result and let this column COLUMN_NAME
so i want to select a field from system procedure result any one can help me
Posted

1 solution

There is no such a thing
SQL
SELECT Col1, Col2 FROM EXEC MY_SP @PRM = 1

What you have to do is declare a temporary table, insert the result of the EXEC into it, than select from that temporary table...
SQL
CREATE PROC MY_SP (@PRM INT)
AS
  SELECT @PRM AS ONE, 2 * @PRM AS TWO

SQL
DECLARE @RESULT TABLE (ONE INT, TWO INT)

INSERT INTO @RESULT
EXEC MY_SP @PRM = 1

SELECT ONE FROM @RESULT
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900