Sunday, 24 February 2013

Store Procedure for all join in multi table


Create PROCEDURE  MultijoinTable
(
@Barcode varchar(30)
)
AS
BEGIN
   
     SELECT   IBD.Barcode,IG.Item_Name, IBD.Gross_Weight, IBD.Stone_Weight,
             IBD.Net_Weight, IBD.Pure_Weight, IBD.MRP,
IBD.Size,IM.Item_Quantity, CATG.Category_Name, ITEMTYPE.Item_Type_Name, IBD.Item_Image,
IBD.Barcode_ID, IBD.Item_ID,IBD.Created_On, IBD.Created_By,
IBD.Modified_On, IBD.Modified_By, IBD.Is_Active, IBD.Is_Deleted,
     IG.Category_ID
FROM  Inventory.ItemBarcodeDetails AS IBD
INNER JOIN Inventory.D_ItemGeneralInfo AS IG
ON IBD.Item_ID = IG.Item_ID
LEFT JOIN  INVENTORY.STOCKQCAPPROVE AS IM
ON IBD.Barcode = IM.Matrix_Detail_ID
INNER JOIN Inventory.D_ItemCategory AS CATG
ON IG.Category_ID = CATG.Category_ID INNER JOIN
Inventory.D_ItemType AS ITEMTYPE
ON IG.Item_Type_ID = ITEMTYPE.Item_Type_ID
WHERE IBD.Barcode=@Barcode
                       COLLATE  SQL_Latin1_General_CP1_CS_AS  //E line ra meaning hela ki je sql small a and capital a sabu buji pare means not keysenstive setihi pain e line lekhila pare ame database ku manekara pathei thiba aa001 jadi  ame front end ru e value napatheiba jadi AA001 patheba taha hele se null value return kariba

 

END

No comments:

Post a Comment