仅显示具有asp值的sql字段

时间:2012-12-12 08:57:28

标签: sql-server-2008 asp-classic

我有一个从sql中检索值的asp网页...它显示没有值的字段..无论如何只显示有值的字段..这是我的表

[] [] []“Mfg Dt和Exp Dt按附件所附”

此方括号包含空值..如果该字段为空,则此方括号不会出现

have to correct

在第一行我有2组方括号,在第二行我有两组值..我需要只显示方括号,如第二行中的值..如果值为空然后不想显示那个空括号。

sql查询

select I.[Old Product Code], I.[Trade Name], I.[Short Name], SUM(Quantity) as Qty,I.[Base Box UOM], SIH.[Customer Marks - 1] ,SIH.[Bill-to Name],SIH.[Bill-to Address], SIH.[Ship-to Name], SIH.[Ship-to Address], SIH.[Ship-to Address 2] ,SIH.[Ship-to City], SIH.[Ship-to Post Code],SIH.[Country of Origin of Goods],SIH.[Bill-to Address 2] ,SIH.[Bill-to City] , SIH.[Bill-to Post Code], CR.Name ,C.Contact,SIH.[Total Boxes], CASE when SIL.[Dimension Group Code] = 'IOL' then I.[Group Description] 
END ,
CASE
    when  I.[EPCG License] = 1 then 'EPCG'
end,
case
    when SIL.[Dimension Group Code] = 'IOL' then 'DEEC'
    when I.[DEEC Lic_] = 1 then 'DEEC'
end as abcd
from [Sales Invoice Header] SIH ,[Customer] C, [Country_Region] CR,
 [Sales Invoice Line]  SIL,[Item] I where I.No_ =  SIL.No_ and SIL.[Document No_]='PEXP1213-110' and SIH.No_ = SIL.[Document No_] and C.No_ =  SIH.[Bill-to Customer No_] and C.[Country_Region Code] = CR.Code group by I.[Old Product Code], I.[Trade Name], I.[Short Name], SIH.[Sell-to Customer Name],SIH.[Sell-to City],SIH.[Customer Marks - 1],SIL.[Dimension Group Code],I.[Group Description], SIH.[Country of Origin of Goods], SIH.[Ship-to Name],SIH.[Ship-to Address], SIH.[Ship-to Address 2] , SIH.[Ship-to City], SIH.[Ship-to Post Code],SIH.[Bill-to Name],SIH.[Bill-to Address],SIH.[Bill-to Address 2],SIH.[Bill-to City] , SIH.[Bill-to Post Code],SIH.[Total Boxes],C.Contact ,CR.Name,I.[Base Box UOM], I.[EPCG License],I.[DEEC Lic_]

1 个答案:

答案 0 :(得分:0)

您需要以编程方式解决此问题,例如

if cstr(rs("Old Product Code"))="[]" then
   response.write("")
else 
   response.write(rs("Old Product Code"))
end if