Anil Kumar Murmu

Anil Kumar Murmu

  • NA
  • 744
  • 327.7k

How to get column names from SP using Entityframework

Aug 2 2016 9:13 AM

How to get multiple result set on conditional basis and also retrieve the column name

 
I want to get the name as Col1, Col2, Col3, Col4 etc. as per the result set. 
 
 
I have a store procedure which looks like

CREATE SP Test

(@Id INT)
AS
BEGIN
IF(@Id ==1)
 BEGIN
 SELECT Col1, Col2 from Table1
END 
IF(@Id ==2)
BEGIN
 SELECT Col1, Col2, Col3 from Table1
END 
ELSE
BEGIN
 SELECT Col4, Col3 from Table1
END 
 END 

Answers (3)