2017-05-09 6 views
-1
@BarId AS INTEGER 
    AS 
    BEGIN 
    SET NOCOUNT ON 

    BEGIN 

    select a.*, b.remark from 
    (
    SELECT 
    min(bardetailid) as BarDetailId, 
    min(barid) as BarId, 
    min(Member) as Member, 
    min(MemberNo) as MemberNo, 
    min(BarMark) as BarMark, 
    [TypeSize] , 
    min(BarLength) as BarLength, 
    min(BarNo) as BarNo, 
    min(BarTotal) as BarTotal, 
    [ShapeCode] , 
    CAST(MAX(CAST(ShapeImage AS VARBINARY(MAX))) AS IMAGE) as ShapeImage, 
    CASE 
     WHEN c.dima <> 0 THEN 
      'A=' + CONVERT(varchar, cast(c.dima AS decimal(18, 0))) 
     ELSE '' 
     END + 
     CASE 
      WHEN c.dimb <> 0 THEN 
       ', B=' + CONVERT(varchar, cast(c.dimb AS decimal(18, 0))) 
      ELSE '' 
     END + 
     CASE 
      WHEN c.dimc <> 0 THEN 
       ', C=' + CONVERT(varchar, cast(c.dimc AS decimal(18, 0))) 
      ELSE '' 
     END + 
     CASE 
      WHEN c.dimd <> 0 THEN 
       ', D=' + CONVERT(varchar, cast(c.dimd AS decimal(18, 0))) 
      ELSE '' 
     END + 
     CASE 
      WHEN c.dime <> 0 THEN 
       ', E=' + CONVERT(varchar, cast(c.dime AS decimal(18, 0))) 
      ELSE '' 
     END + 
     CASE 
      WHEN c.dimf <> 0 THEN 
       ', F=' + CONVERT(varchar, cast(c.dimf AS decimal(18, 0))) 
      ELSE '' 
     END + 
     CASE 
      WHEN c.dimg <> 0 THEN 
       ', G=' + CONVERT(varchar, cast(c.dimg AS decimal(18, 0))) 
      ELSE '' 
     END + 
     CASE 
      WHEN c.dimn <> 0 THEN 
       ', N=' + CONVERT(varchar, cast(c.dimn AS decimal(18, 0))) 
      ELSE '' 
     END 
     AS Dimension, 
     min(DimA) AS DimA, 
     min(DimB) AS DimB, 
     min(DimC) AS DimC, 
     min(DimD) AS DimD, 
     min(DimE) AS DimE, 
     min(DimF) AS DimF, 
     min(DimG) AS DimG, 
     min(DimN) AS DimN, 
     min(Active) AS Active, 
     min(c.CreatedDtTm) AS CreatedDtTm, 
     min(createdby) as CreatedBy, 
     min(createdip) AS [CreatedIp], 
     min(UpdatedDtTm) as [UpdatedDtTm], 
     min(UpdatedBy) AS [UpdatedBy], 
     min(UpdatedIp) AS [UpdatedIp] 
    FROM   bar_schedule_detail c 
    WHERE   active = 1 
    AND    barid = @BarId  
    GROUP BY 
    [TypeSize],  
    [ShapeCode] , 
    CASE 
     WHEN dima <> 0 THEN 
      'A=' + CONVERT(varchar, cast(dima AS decimal(18, 0))) 
     ELSE '' 
     END + 
     CASE 
      WHEN dimb <> 0 THEN 
       ', B=' + CONVERT(varchar, cast(dimb AS decimal(18, 0))) 
      ELSE '' 
     END + 
     CASE 
      WHEN dimc <> 0 THEN 
       ', C=' + CONVERT(varchar, cast(dimc AS decimal(18, 0))) 
      ELSE '' 
     END + 
     CASE 
      WHEN dimd <> 0 THEN 
       ', D=' + CONVERT(varchar, cast(dimd AS decimal(18, 0))) 
      ELSE '' 
     END + 
     CASE 
      WHEN dime <> 0 THEN 
       ', E=' + CONVERT(varchar, cast(dime AS decimal(18, 0))) 
      ELSE '' 
     END + 
     CASE 
      WHEN dimf <> 0 THEN 
       ', F=' + CONVERT(varchar, cast(dimf AS decimal(18, 0))) 
      ELSE '' 
     END + 
     CASE 
      WHEN dimg <> 0 THEN 
       ', G=' + CONVERT(varchar, cast(dimg AS decimal(18, 0))) 
      ELSE '' 
     END + 
     CASE 
      WHEN dimn <> 0 THEN 
       ', N=' + CONVERT(varchar, cast(dimn AS decimal(18, 0))) 
      ELSE '' 
     END 
     ) as a, bar_schedule_detail b 
     where a.typesize = b.typesize 
     and a.shapecode = b.shapecode 
     and 
     (
     CASE 
     WHEN b.dima <> 0 THEN 
     'A=' + CONVERT(varchar, cast(b.dima AS decimal(18, 0))) 
    ELSE '' 
    END + 
    CASE 
    WHEN b.dimb <> 0 THEN 
     ', B=' + CONVERT(varchar, cast(b.dimb AS decimal(18, 0))) 
    ELSE '' 
    END + 
    CASE 
    WHEN b.dimc <> 0 THEN 
     ', C=' + CONVERT(varchar, cast(b.dimc AS decimal(18, 0))) 
    ELSE '' 
    END + 
    CASE 
    WHEN b.dimd <> 0 THEN 
     ', D=' + CONVERT(varchar, cast(b.dimd AS decimal(18, 0))) 
    ELSE '' 
    END + 
    CASE 
    WHEN b.dime <> 0 THEN 
     ', E=' + CONVERT(varchar, cast(b.dime AS decimal(18, 0))) 
    ELSE '' 
    END + 
    CASE 
    WHEN b.dimf <> 0 THEN 
     ', F=' + CONVERT(varchar, cast(b.dimf AS decimal(18, 0))) 
    ELSE '' 
    END + 
    CASE 
    WHEN b.dimg <> 0 THEN 
     ', G=' + CONVERT(varchar, cast(b.dimg AS decimal(18, 0))) 
    ELSE '' 
    END + 
    CASE 
    WHEN b.dimn <> 0 THEN 
     ', N=' + CONVERT(varchar, cast(b.dimn AS decimal(18, 0))) 
    ELSE '' 
    END 
    ) = a.dimension 
    and a.CreatedDtTm = b.CreatedDtTm 
    and b.active = 1 
    and b.barid = @BarId  
    ORDER BY 
    substring(a.TypeSize,1,1) desc, 
    BarLength desc 
    END 
    END 

Error in Crystal ReportCrystalレポートは、私はコードをデバッグ時には、上記示したようCrystalレポートは、ページを表示しません

ページを表示しません。私のSQL Serverでコードを実行すると、すべてが正しく実行されます。私のプログラミングの知識の限界のために。誰かが私が直面している問題を特定できますか?

+0

データ型をvarcharからnvarcharに変更します – Mahendra

+0

@Mahendra値を変更するときにも同じ問題が残ります。 where節で ANDメンバー( '%[^ 0-9]%'、active = 1、barid = @ BarIdのようなメンバー)のSELECT MIN(メンバー)をBAR_SCHEDULE_DETAILから試してみましたが、まだ動作しません。 これはレポートを表示しますが、1つのレコードだけで、エラーメッセージが表示されていた以前の問題が改善されました。 –

+0

はサンプルデータと必要な出力を提供するだけです。 – Mahendra

答えて

0

私はこのコードa.BarDetailId = b.BarDetailId and a.shapecode = b.shapecodeを追加してこの問題を解決しました。

関連する問題