Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I am using stored procedure which returning more one table in sql .
But when i am using this stored procedure in entity framework its returning only 1 table. i also tried set FMTONLY Off at the begining of stored procedure but is same . how to resolve this problem .?
stored procedure-
SQL
USE [UPOR_DE_MAIN]
GO
/****** Object:  StoredProcedure [dbo].[usp_s_UDMFieldForUpdate ]    Script Date: 11/25/2015 17:43:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
  
        
                
-- usp_s_UDMFieldForUpdate 26,4,2,345145                  
                                     
ALTER PROCEDURE [dbo].[usp_s_UDMFieldForUpdate ]                                                                                                   
@DistrictCode int,                                                                                                                  
@TalukCode int,                                                                                                                  
@TownId int,                                                                                                                  
@ChaltaId int                                                                                                                  
as                                                                                                                  
begin    
SET FMTONLY OFF                                                                                                            
                                                                                                              
select pm.DistrictCode, pm.TalukCode, pm.TownId,ZoneId,SectorId,BlockId,pm.ChaltaId, RoadNumber,                                                                                                              
 RoadName, Pincode, TenureCode, EncumberenceType, Encumberence,                                                                                                              
 EasementTypeCode, EasementRights, CommonProperty, OtherRights,                                                                                                              
 NoticeServedTypeCode, convert(varchar,NoticeServedDate,103) as NoticeServedDate,                                                                                                               
PropertyUsageType,                                                                                                               
PersonWhileMeasuring, convert(varchar,MeasurementDate,103) as MeasurementDate,                                                                                                               
BuildingExists, StructureCode,                                                                                                              
Disputes, Lease, DoorNo, BuildingBlock, Floor, MeasurementDispute,                                                                                                              
MeasurementDisputeDetails, MeasurementDispute_ChaltaId, DataEnteredOn,                                                                                                              
 DataEnteredBy, Status, QCDoneBy, QCDoneOn, QCRemarks,                                                    
 SP_UpdatedBy,  NoOfFloor,isnull(Ltrim(RTRIM(salable)),'No') as Salable,                                                                                                             
SP_UpdatedOn,FDESource,Authorized,FinalPropertyCategory as PropertyCategory,isnull(IssueOpened,'N') as IssueOpened, GeneralRemarks,    
isnull(CM.FlatNo,'0') as FlatNo,    
isnull(MF.FloorName,'0') as FloorNo,  
isnull(CM.BlockNumber,'N/A') as BuildingBlockNo                                                     
 from UPOR_Property_Main pm                                                             
left outer join dbo.UPOR_ChaltaMain cm on                                                               
cm.DistrictCode=pm.DistrictCode and                                                            
cm.TalukCode=pm.TalukCode and                                                            
cm.TownId=pm.TownId and                                                            
cm.ChaltaId=pm.ChaltaId     
Left outer join Master_Floor MF on MF.FloorId = CM.FloorId                                                                                                           
where pm.DistrictCode=@DistrictCode and  pm.TalukCode=@TalukCode and                                                                                                            
pm.TownId=@TownId  and pm.ChaltaId=@ChaltaId                                                            
                                                                                  
select  DistrictCode,TalukCode, TownId, ChaltaId, OwnerNo,                                                                         
 OwnerName, MainOwnerNo,                                                                 
PostalAddress, MobileNo, EpicNo, Email, IsStayingInHouse ,                            
 Relationship  ,RelativeName,RelationDesc,PropertyType,isnull(PropertyTypeId,0)as PropertyTypeId,[PAN Number]as PANNO,[UID Number]as UID                                             
from UPOR_Property_Owners po left join Master_STD_RelationType m                                                       
on m.RelationId=po.Relationship  where                                            
DistrictCode=@DistrictCode and  TalukCode=@TalukCode and                                                                     
TownId=@TownId  and ChaltaId=@ChaltaId                                                                                         
                                                            
                                                                                                              
select DistrictCode, TalukCode, TownId, ChaltaId, PlotDimensionId,                                                                                                              
 MeasurementUnit, Length, Breadth from UPOR_Property_PlotDimensions                                                                                                              
where DistrictCode=@DistrictCode and  TalukCode=@TalukCode and                                                                                                    
TownId=@TownId  and ChaltaId=@ChaltaId                                                                                                              
                                                                                                        
                                                                                    
select  DirectionId as DirectionCode,DireciionDiscription as Direction,                                                                                                              
AdjacentIsProperty as AdjacentIsProperty,                                                                                                       
AdjacentPropertyChaltaId as AdjChaltaId,                                                                                                       
AdjacentPropertyDetail as AdjPropertyDetail, ChaltaNo as AdjChaltaNo,                                                                                                              
AdjacentPropertyTownId as AdjTownId, Others_Checkbandi as Others from                                                                                                 
UPOR_Property_Schedule s left join Master_Directions d on                                                                                               
s.DirectionId=d.DirectionCode                                                                                                                
left join UPOR_ChaltaMain cm on cm.DistrictCode=s.DistrictCode and                                                                                                                
cm.TalukCode=s.TalukCode and cm.TownId=s.TownId and cm.ChaltaId=s.AdjacentPropertyChaltaId                                                                                                           
 where                                                                                                                 
s.DistrictCode= @DistrictCode and s.TalukCode=@TalukCode and                         
 s.TownId=@TownId and s.ChaltaId=@ChaltaId                                                                                                              
                                                                                                          
                                                                                                              
select DistrictCode, TalukCode, TownId, ChaltaId, PropertyLeaseId,                                                                       LeasDetails, LeaseType, OrderNo, convert(varchar,Date,103) as Date,                                                  
   
    
     
                          
[Year],[Month],convert(varchar,FromDate,103) as FromDate,convert(varchar,ToDate,103) as ToDate, Amount,LeaseTypeDescription from                                                                                                               
UPOR_Property_LeaseDetails  pl left join Master_LeaseType m                                                                                                    
on m.LeaseTypeCode=pl.LeaseType                                                                              
where DistrictCode=@DistrictCode and  TalukCode=@TalukCode and                                                                                                              
TownId=@TownId and ChaltaId=@ChaltaId                                                                                      
                                          
--DisputeDetails                                       
select DistrictCode, TalukCode, TownId, ChaltaId, PropertyDisputeID,                                                     
pd.DisputeType, DisputeTypeDescription,Disputer, DisputeDetails, CaseNumber, convert(varchar,CaseDate,103) as CaseDate, pd.CourtName, MC.CourtName as NameofCourt                                                                 
,LitigationDesc,LitigationId from UPOR_Property_DisputeDetails  pd left join Master_DisputeTypes m                                                                  
on m.DisputeType=pd.DisputeType left join Master_Courts MC on                                                                                   
MC.CourtId=pd.CourtName                                                                                
left outer join dbo.Master_Litigations ml on ml.LitigationId=m.DisputeType                                                                                
where DistrictCode=@DistrictCode and  TalukCode=@TalukCode and                                                                                                            
TownId=@TownId  and ChaltaId=@ChaltaId                                                                                                             
                                                                                  
--Photo Details                                                                        
select DistrictCode, TalukCode, TownId, ChaltaId, PhotoId, PhotoPath                                                                                                              
from UPOR_Property_BuildingPhotos                                                                      
where DistrictCode=@DistrictCode and  TalukCode=@TalukCode and                                                                                                              
TownId=@TownId  and ChaltaId=@ChaltaId                                                                                                              
                                                                                  
select DistrictCode, TalukCode, TownId, ChaltaId, PropertyBuildingId,                                                                                                               
MeasurementUnit,  length, Breadth from UPOR_Property_BuildingDimensions                
where DistrictCode=@DistrictCode and  TalukCode=@TalukCode and                                                                                                              
TownId=@TownId  and ChaltaId=@ChaltaId                                                  
                                                                                                              
--MDispute Details                                                                                                            
--select DistrictCode, TalukCode, TownId, ChaltaId, MeasurementDispute_ChaltaId, MeasurementDisputeDetails as Dispute                                                                  
--from dbo.UPOR_Property_MeasurementDispute                                                                  
--where                                                                   
--DistrictCode=@DistrictCode and                                                  
--TalukCode=@TalukCode and                                                                  
--TownId=@TownId and                                            
--(ChaltaId=@ChaltaId or MeasurementDispute_ChaltaId=@ChaltaId)                                                                                                   
----select  s.ChaltaId, RoadNumber,ChaltaNo,                                                                                                    
---- RoadName, Pincode, MeasurementDispute,                                                                  
----MeasurementDisputeDetails as Dispute, MeasurementDispute_ChaltaId, DataEnteredOn,                                                                                        
---- DataEnteredBy, Status, QCDoneBy, QCDoneOn, QCRemarks, SP_UpdatedBy,                                                                                               
----SP_UpdatedOn, Blocked from UPOR_Property_Main s                                                                                                     
----left join UPOR_ChaltaMain cm on cm.DistrictCode=s.DistrictCode and                                                                             
----cm.TalukCode=s.TalukCode and cm.TownId=s.TownId and cm.ChaltaId=s.ChaltaId                                                                                                        
----where                                                                     
---- s.DistrictCode=@DistrictCode and  s.TalukCode=@TalukCode and                                                            
----s.TownId=@TownId  and MeasurementDispute_ChaltaId=@ChaltaId and                                              
---- s.ChaltaId<>@ChaltaId                                                                    
--                                                                    
--UNION                                       
--                                                                    
--select  s.ChaltaId, RoadNumber,ChaltaNo,                                                                                 
-- RoadName, Pincode, MeasurementDispute,                                                                                                   
--MeasurementDisputeDetails as Dispute, MeasurementDispute_ChaltaId, DataEnteredOn,                                                                                       
-- DataEnteredBy, Status, QCDoneBy, QCDoneOn, QCRemarks, SP_UpdatedBy,                                                                                                         
--SP_UpdatedOn, Blocked from UPOR_Property_Main s                                                                                                               
--left join UPOR_ChaltaMain cm on cm.DistrictCode=s.DistrictCode and                                                       
--cm.TalukCode=s.TalukCode and cm.TownId=s.TownId and cm.ChaltaId=s.ChaltaId                             
--where                                                                                                               
-- s.DistrictCode=@DistrictCode and  s.TalukCode=@TalukCode and                              
--s.TownId=@TownId  and  s.chaltaid in (Select MeasurementDispute_ChaltaId from UPOR_Property_Main                                                                    
--where  DistrictCode=@DistrictCode and  TalukCode=@TalukCode and                                                                                                              
--TownId=@TownId and chaltaid=@ChaltaId and chaltaid<>s.chaltaid                                                        
--)                                                                    
                                                        create table #table(MeasurementDispute_ChaltaId int,ChaltaId int,Dispute nvarchar(1000),ChaltaNo nvarchar(100),Blocked char(1))                                                                 
insert into #table(MeasurementDispute_ChaltaId ,ChaltaId ,Dispute ,ChaltaNo ,Blocked )                                                              
(select md.ChaltaId,  md.MeasurementDispute_ChaltaId, md.MeasurementDisputeDetails                                                                  
,cm.ChaltaNo,Blocked                                                                  
from dbo.UPOR_Property_MeasurementDispute md                                                              
left outer join dbo.UPOR_ChaltaMain cm on                                                                   
cm.DistrictCode=md.DistrictCode and                                                                  
cm.TalukCode=md.TalukCode and                                                                  
cm.TownId=md.TownId and                                                                  
cm.ChaltaId=md.MeasurementDispute_ChaltaId                                                                  
left outer join dbo.UPOR_Property_Main pm on                                                                  
pm.DistrictCode=md.DistrictCode and                                                                  
pm.TalukCode=md.TalukCode and                                                                  
pm.TownId=md.TownId and                      
pm.ChaltaId=md.ChaltaId                                                                  
                                                                  
where                                                                   
md.DistrictCode=@DistrictCode and                                                                  
md.TalukCode=@TalukCode and                                         
md.TownId=@TownId and                                                                  
md.ChaltaId=@ChaltaId )                                                              
insert into #table(MeasurementDispute_ChaltaId ,ChaltaId ,Dispute ,ChaltaNo ,Blocked )                                                       
(select md.MeasurementDispute_ChaltaId,md.ChaltaId, md.MeasurementDisputeDetails                                                                  
,cm.ChaltaNo,Blocked                                  
from dbo.UPOR_Property_MeasurementDispute md                                                                  
left outer join dbo.UPOR_ChaltaMain cm on                                                                 
cm.DistrictCode=md.DistrictCode and                                                                  
cm.TalukCode=md.TalukCode and                                                                  
cm.TownId=md.TownId and                                              
cm.ChaltaId=md.ChaltaId                                                                  
left outer join dbo.UPOR_Property_Main pm on                                                                  
pm.DistrictCode=md.DistrictCode and                                         
pm.TalukCode=md.TalukCode and                                                                  
pm.TownId=md.TownId and                                                                  
pm.ChaltaId=md.MeasurementDispute_ChaltaId                                             
                                                                  
where                                                                   
md.DistrictCode=@DistrictCode and                                                                  
md.TalukCode=@TalukCode and                                                                  
md.TownId=@TownId and                                                                  
md.MeasurementDispute_ChaltaId=@ChaltaId)                                                              
select MeasurementDispute_ChaltaId ,ChaltaId ,Dispute ,ChaltaNo ,Blocked from  #table                                                              
drop table #table                                                    
                                                     
                                                                        
--Building Details                                                                                                         
select DistrictCode, TalukCode, TownId, ChaltaId, BuildingAreaUnit, PlotAreaUnit,                                                                         
BuildingArea, PlotAreaAcre, PlotAreaGunta                                                                                                          
from UPOR_Property_AreaDetails                                      
where DistrictCode= @DistrictCode and TalukCode=@TalukCode and                                                                                           
 TownId=@TownId and ChaltaId=@ChaltaId                                                                                                           
                                                                        
--Lease Details                                                                                                          
select DistrictCode, TalukCode, TownId,                                                                                                   
ChaltaId, PropertyLeaseId, LeaserId, LeaserType,                                                                                            
Leaser, Relationship,RelationDesc, Relative                                                                                                  
from dbo.UPOR_Property_LeaseDetails_Owners mlo                                                                                                   
left outer join dbo.Master_STD_RelationType mrt on mrt.RelationId=mlo.Relationship                                                                                          
where DistrictCode= @DistrictCode and TalukCode=@TalukCode and                                                     
 TownId=@TownId and ChaltaId=@ChaltaId                                                                                                
                                                                                                
--GPA Details                                                                                                           
select DistrictCode, TalukCode, TownId,                                                                                              
ChaltaId, gpa.LeaseGPAId, OwnerNo, OrderNumber,                                                                
convert(varchar,Date,103) as Date, [Year],[Month], Amount, Details, LeaseGPAOwnerNo, HolderName, RelationShip,RelationDesc, RelativeName         
from dbo.UPOR_Property_GPADetails gpa         
left outer join dbo.UPOR_Property_GPADetails_Owners gpao on gpao.LeaseGPAId=gpa.LeaseGPAId                                                                  
left outer join dbo.Master_STD_RelationType mrt on mrt.RelationId=gpao.RelationShip                                                                                                
where DistrictCode= @DistrictCode and TalukCode=@TalukCode and                                                                                                            
 TownId=@TownId and ChaltaId=@ChaltaId                               
                                                      
--Liability Details                                                                                                
select DistrictCode, TalukCode, TownId, ChaltaId, LiabilityId, pld.Type as Type, LiabilityTypeDescription, OrderNumber,        
 convert(varchar,Date,103) as Date, Amount, pld.BankId, BankName, BankBranch , [Year], [Month]                                         
from UPOR_Property_LiabilityDetails pld left join Master_Liabilities ML on                                                                                     
ML.LiabilityType = pld.Type left join Master_Banks MB on MB.BankId = pld.BankId                                                                                                
where DistrictCode=@DistrictCode and  TalukCode=@TalukCode and                                                                     
TownId=@TownId  and ChaltaId=@ChaltaId                                                      
             
--Restriction details                                                                                                
Select DistrictCode, TalukCode, TownId, ChaltaId, RestrictionID, prd.TypeOfRestriction as TypeOfRestriction, RestrictionDesc, OrderNo,        
convert(varchar,OrderDate,103) as OrderDate, Details, Periodtype, RestrictionPeriod         
from UPOR_Property_RestrictionDetails prd left join Master_Restrictions MR on                                                                                                 
MR.RestrictionType = prd.TypeOfRestriction                                                                      
where DistrictCode=@DistrictCode and  TalukCode=@TalukCode and                                                                                   
TownId=@TownId  and ChaltaId=@ChaltaId                                                                              
                                                                              
select UsageStructureId from dbo.UPOR_Property_UsageStructure                                                   
where DistrictCode=@DistrictCode and  TalukCode=@TalukCode and                                                                                                            
TownId=@TownId  and ChaltaId=@ChaltaId                                                               
                                                          
                                                    
--ChaltaNoIssues Details                                                                                                          
select  DistrictCode, TalukCode, TownID, ChaltaId,                                                           
mlo.ChaltaNoIssueID, IssueDetailsId   , ChaltaNoIssueDescription                                                                         
from dbo.UPOR_TE_ChaltaNoIssues mlo                       
left outer join dbo.Master_ChaltaNoIssues mrt on mrt.ChaltaNoIssueID=mlo.ChaltaNoIssueID                                                                                          
where DistrictCode= @DistrictCode and TalukCode=@TalukCode and                                                                                                            
 TownId=@TownId and ChaltaId=@ChaltaId                                                             
                        
--ChaltaNoIssueNotice Details                                                                                                           
select   DistrictCode, TalukCode, TownID, ChaltaId,                                                           
IssueDetailsId, NoticeIssueDetailsId, NoticeServedType,NoticeServedDescription,                                                          
 convert(varchar,NoticeServedDate,103) as NoticeServedDate, Remarks                                                                                              
from dbo.UPOR_TE_ChaltaNoIssueNoticeDetails mlo                          
left outer join dbo.Master_NoticeServedType mrt on mrt.NoticeServedCode=mlo.NoticeServedType                                                                                          
where DistrictCode= @DistrictCode and TalukCode=@TalukCode and                                                                                                            
 TownId=@TownId and ChaltaId=@ChaltaId                                                                           
                                                        
--Property Rights                                                                
select  DistrictCode, TalukCode, TownId, ChaltaId,                                                         
RightDetailId, mlo.PropertyRightId , Remarks   , RightDescription                                                                    
from dbo.UPOR_Property_Rights mlo                                      
left outer join dbo.Master_PropertyRights mrt on mrt.PropertyRightId=mlo.PropertyRightId                                        
where DistrictCode= @DistrictCode and TalukCode=@TalukCode and                                                                                                            
 TownId=@TownId and ChaltaId=@ChaltaId                                                  
                                                 
 --Shared Property                                                
select a.ChaltaId, SharedChaltaId,                                                
(convert(varchar,ChaltaNo)+isnull(AdditionalNo,'')) as ChaltaNo,isnull(SubChaltaNo,'') as                                                 
SubChaltaNo  ,SharedRemarks                                              
 from                                                 
dbo.UPOR_Property_Shared as a left outer join dbo.UPOR_ChaltaMain as b                                                
on b.ChaltaId=a.SharedChaltaId                                                
 where a.DistrictCode= @DistrictCode and a.TalukCode=@TalukCode and                                                                                                            
 a.TownId=@TownId and a.ChaltaId=@ChaltaId                                         
                                       
                                       
 ----EaseMentProperty                                               
 select d.EasementChaltaId, EasementSharedChaltaId,                                                  
(convert(varchar,ChaltaNo) + isnull(AdditionalNo,'')) as ChaltaNo,isnull(SubChaltaNo,'') as                                       
SubChaltaNo ,EasementSharedRemarks,EasementType ,a.EasementTypeDescription                                              
 from                                                   
dbo.UPOR_EaseMentProperties as d left outer join dbo.UPOR_ChaltaMain as e                                                  
on e.ChaltaId=d.EasementSharedChaltaId                            
inner join Master_EasementType a on  a.EasementTypeCode=d.EasementType                                                    
 where d.DistrictCode= @DistrictCode and d.TalukCode=@TalukCode and                                                                                                            
 d.TownId=@TownId and d.EasementChaltaId=@ChaltaId                           
                                        
    ---- PropertyCategory            
select UPM.FinalPropertyCategory,ISNULL( mpc.PropertyCategoryDesc,'Not Set') as PropetyCategory             
from UPOR_Property_Main as UPM            
left outer join Master_PropertyCategory as MPC on UPM.FinalPropertyCategory =MPC.PropertyCategoryId            
             where UPM.DistrictCode= @DistrictCode and UPM.TalukCode=@TalukCode and                                                                                                            
 UPM.TownId=@TownId and UPM.ChaltaId=@ChaltaId             
       
 -----Apartment      
  Declare @Land nvarchar(Max)       
 Declare @CarParking nvarchar(max)      
 declare @superbuiltuparea numeric(18,2)
 declare @builtuparea numeric(18,2)
 declare @commonarea numeric(18,2)
 Select @Land =isnull(Land,'') ,@CarParking=isnull(CarparkingArea,'')
 ,@superbuiltuparea=ISNULL(SuperBuiltUpArea,'0.0'),@BuiltUpArea=ISNULL(BuiltUpArea,'0.0'),
 @commonarea=ISNULL(CommonArea,'0.0')
 from UPOR_Property_Main where DistrictCode =@DistrictCode and TalukCode =@TalukCode and TownId =@TownId and ChaltaId =@ChaltaId       
 Select @Land as Land,@CarParking as CarParking ,@superbuiltuparea as SuperBuiltUpArea,
 @builtuparea as BuiltUpArea , @commonarea as CommonArea
       
       
          
end
Posted
Updated 25-Nov-15 1:40am
v2

1 solution

I googled "stored procedure multiple select entity framework" for you and here are the top three results.

https://msdn.microsoft.com/en-us/data/jj691402.aspx[^]


Returning Multiple Result Sets from an Entity Framework Stored Procedure with Function Import Mappings[^]

http://forums.asp.net/t/2018635.aspx?Handle+Multiple+Result+set+in+Stored+Procedure+using+Entity+Framework+[^]

Please do your own basic research before asking a question.
 
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