Note that there are some explanatory texts on larger screens.

plurals
  1. POStored Procedure output error
    primarykey
    data
    text
    <p>My stored procedure has two cursors. The output of the stored procedure is in the following format.</p> <pre><code>companyid companyname id idname level3 level4 level5 currency accountdefinition accname accountno debits credits ----------- -------------------------------------------------- ----------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ----------- --------------------------------------- --------------------------------------- 101 Fund One Company 1001 Test Fund Assets Assets for PL Accounts NULL NULL NULL NULL NULL KWD CA Current Account NULL NULL NULL (1 row(s) affected) companyid companyname id idname level3 level4 level5 currency accountdefinition accname accountno debits credits ----------- -------------------------------------------------- ----------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ----------- --------------------------------------- --------------------------------------- 101 Fund One Company 1001 Test Fund Assets Assets for PL Accounts NULL NULL NULL NULL NULL KWD CA Current Account NULL NULL NULL (1 row(s) affected) companyid companyname id idname level3 level4 level5 currency accountdefinition accname accountno debits credits ----------- -------------------------------------------------- ----------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ----------- --------------------------------------- --------------------------------------- 101 Fund One Company 1001 Test Fund Assets Accounts for MM PL accounts NULL NULL NULL NULL NULL KWD MPL PL accounts for MM NULL NULL NULL (1 row(s) affected) </code></pre> <p>Instead of showing all 3 rows as a single output. It is showing each row as a single output. This is causing an issue in the reporting level.</p> <p>code:</p> <pre><code>alter PROCEDURE TrialBalance ( @companyid INT, @id INT --Input parameter , Studentid of the student --@id VARCHAR(200) OUT -- Out parameter declared with the help of OUT keyword ) AS BEGIN declare @level3 varchar(50),@level4 varchar(50),@level5 varchar(50),@level6 varchar(50),@level7 varchar(50),@level8 varchar(50),@level9 varchar(50),@level10 varchar(50),@level11 varchar(50),@rfrom int,@rto int, @companyname varchar(50),@idname varchar(50),@accname varchar(50),@debits decimal(15,3),@credits decimal(15,3),@acno int,@acname varchar(25) declare c cursor for SELECT level3, level4, level5, level6, level7, level8, level9, level10, level11, rangefrom, rangeto from linedetails where level1 = @companyid and level2 = @id order by reportlineid select @companyname = description from company where companycode = @companyid select @idname = description from fundparameters where fundid = @id open c fetch next from c into @level3,@level4,@level5,@level6,@level7,@level8,@level9,@level10,@level11,@rfrom,@rto WHILE @@FETCH_STATUS = 0 BEGIN select @accname = description from accounttype where accounttypeid = @level11 if @rfrom is not null and @rto is not null declare d cursor for select accountno,totaldebitslcy,totalcreditslcy from fund.dbo.account where (accountno &gt;= @rfrom and accountno &lt;= @rto) and currency = @level10 open d fetch next from d into @acno,@debits,@credits WHILE @@FETCH_STATUS = 0 BEGIN select @companyid as companyid ,@companyname as companyname ,@id as id ,@idname as idname,@level3 as level3 ,@level4 as level4,@level5 as level5, @level6, @level7, @level8, @level9, @level10 as currency, @level11 as accountdefinition ,@accname as accname,@acno as accountno, @debits as debits,@credits as credits fetch next from d into @acno,@debits,@credits end close d deallocate d fetch next from c into @level3,@level4,@level5,@level6,@level7,@level8,@level9,@level10,@level11,@rfrom,@rto end end close c deallocate c </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload