Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
1.22/5 (2 votes)
See more:
Hi, I have the below SQL codes, all is error free but on thing I dont understand is how can I make the returned values to be displayed? Thank you. E.g. I want to display SalesOrder. Below are my codes,

SQL
ALTER PROCEDURE [dbo].[usp_SalesOrderForUnit_Select]
      @UnitID BigInt
AS 
BEGIN 
    SELECT DISTINCT
            so.Number as SalesOrder
         ,sog.Number as SalesOrderGroup
         ,so.NumberPurchaseOrder as PurchaseOrder
      FROM
      --    UnitSetup.UnitDetail AS ud
      --INNER JOIN ProductionControl.ContainerContent cc
      --    ON ud.UnitHeaderId = cc.UnitHeaderId
      --    AND cc.DateEffectiveOut = '99991231 23:59:59.999'
     --INNER JOIN UnitSetup.SalesOrderGroupVersion AS sogv
      --    ON sogv.SalesOrderGroupVersionId = cc.SalesOrderGroupVersionId
      --INNER JOIN UnitSetup.SalesOrderGroup AS sog
      --    ON sog.SalesOrderGroupId = sogv.SalesOrderGroupId
      --INNER JOIN UnitSetup.SalesOrder AS so
      --    ON so.SalesOrderId = sog.SalesOrderId
      
            UnitSetup.UnitIdentity AS ui
      INNER JOIN UnitSetup.SalesOrder     AS so
            ON ui.SalesOrderId=so.SalesOrderId
            AND ui.DateEffectiveOut=CAST('99991231 23:59:59.999' AS DATETIME2(3))
      INNER JOIN UnitSetup.SalesOrderGroupVersion AS sogv
            ON sogv.SalesOrderGroupVersionId=ui.SalesOrderGroupVersionId
      INNER JOIN UnitSetup.SalesOrderGroup AS sog     
            ON sog.SalesOrderGroupId=sogv.SalesOrderGroupId
            AND sog.SalesOrderId=so.SalesOrderId

      WHERE
            ui.UnitHeaderId = @UnitID
      
END
Posted
Comments
Manas Bhardwaj 12-Nov-14 4:04am    
Where do you display the result?
Laiju k 12-Nov-14 4:05am    
where do you want to display.please add tags
OriginalGriff 12-Nov-14 4:10am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
So we need to know what you are trying to do in better detail: how are you trying to display it? Website? WinForms? In SSMS? And then we need to know what is stopping you from doing that!
Use the "Improve question" widget to edit your question and provide better information.
Jamie888 12-Nov-14 20:30pm    
Sorry for late reply, the above codes are inside SQL Management Studio 2008 R2. I want to display the result after the "END". Because after each time I execute the codes, it will only prompt me Command Executed Successfully.
Shweta N Mishra 14-Nov-14 4:28am    
where do you want result to be displayd, In SQL or in UI where this SP is called

1 solution

Hi,

it seem like you might have set query options grid property

"Discard result after execution" to true,

please disable it and try.
 
Share this answer
 
v2

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