Click here to Skip to main content
15,905,504 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi i want to get details from four tables.and display it in their related field while i save the same record.

this is my sp to get details
SQL
ALTER PROCEDURE [dbo].[usp_GetTPR1Details]
@DID varchar(10),
@DocType varchar(4)
AS BEGIN
Select * from tblStockDetails,tblStockHeader,tblTender,tblBidTree where btDID=@DID and btDocType=@DocType and sdDID=@DID and sdDocType=@DocType and tndDID=@DID and tndDocType=@DocType and sdDocType='TPR1'
END


here DID and DocType is the Common for tblStockDetails,tblStockHeader,tblBidTree and tblTender..

bt am not getting values can any one suggest me?
thank u
Posted
Updated 19-Jun-12 20:00pm
v2

1 solution

Did you mean to add the last bit:
SQL
and sdDocType='TPR1'
Because it makes the parameter redundant:
SQL
and sdDocType=@DocType and
 
Share this answer
 
Comments
ythisbug 20-Jun-12 2:17am    
thanks griff..bt also not getting values
OriginalGriff 20-Jun-12 2:22am    
What did you change it to?
ythisbug 20-Jun-12 2:23am    
ALTER PROCEDURE [dbo].[usp_GetTPR1Details]
@DID varchar(10),
@DocType varchar(4)
AS BEGIN
Select * from tblStockDetails,tblStockHeader,tblTender,tblBidTree
where btDID=@DID and btDocType=@DocType and sdDID=@DID and sdDocType=@DocType and tndDID=@DID and tndDocType=@DocType

like this i tried
OriginalGriff 20-Jun-12 3:05am    
That looks a bit better.
There are two possibilities:
1) Have you tried fully qualifying your fields?
WHERE lblBitTree.btDID=@DID AND tblStockDetails.sdDID=@DID AND ...
2) Have you checked your data to make sure there are matching fields? If not, try reducing the WHERE clause until you do get data, then slowing increase until you don't. That would at least give you an idea where to look to find the problem!
ythisbug 20-Jun-12 2:24am    
sry i dint understand wat u said

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