Msg 512, Level 16, State 1, Procedure Rpt_RSQC_MRRFormSSRSSp, Line 261 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, , >= or when the subquery is used as an expression.

  • I am executing a SP and am getting this error:

    Msg 512, Level 16, State 1, Procedure Rpt_RSQC_MRRFormSSRSSp, Line 261
    Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

    I believe I have narrowed down the expression to this:

    ,(select dcode from RS_QCTran where rcvr_num = rs_qcmrr.rcvr_num and mrr_num = rs_qcmrr.mrr_num and stat = 'REJECTED') as REJECTED_Dcode

    when I replace rs_qcmrr.rcvr_num and rs_qcmrr.mrr_num with the numbers and run the query seperately:

    select dcode, * from RS_QCTran_mst where rcvr_num = '5708' and mrr_num = '   165' and stat = 'REJECTED'

    I get 3 rows of results.

    I need to be able to get all 3 dcode results into 1 column.

    How can I accomplish this?

  • With a little help from you guys on other posts, and google, I was able to put together this syntax and it worked!!


    , (Select STUFF((Select ';' + dcode
                From RS_QCTran_mst
              where rcvr_num = rs_qcmrr.rcvr_num and mrr_num = rs_qcmrr.mrr_num and stat = 'REJECTED'
                FOR XML PATH('')), 1, 1, '')) as Rejected_Dcode

  • The issue occurs due to the subquery of msdb.dbo.sp_sqlagent_get_perf_counters system stored procedure calculates value of counter incorrectly. The subquery lacks an inner join relationship for the column in condition of subquery. Go through the workaround of SQL error 512: 
    https://support.microsoft.com/en-us/help/2587511/fix-error-when-a-sql-server-performance-condition-alert-is-raised-in-s

  • Johnson Welch - Thursday, December 13, 2018 4:03 AM

    The issue occurs due to the subquery of msdb.dbo.sp_sqlagent_get_perf_counters system stored procedure calculates value of counter incorrectly. The subquery lacks an inner join relationship for the column in condition of subquery. Go through the workaround of SQL error 512: 
    https://support.microsoft.com/en-us/help/2587511/fix-error-when-a-sql-server-performance-condition-alert-is-raised-in-s

    What?

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply