数据库读取数据NULL值替换

ISNULL直接替换时会删掉表头,故需要Weather = ISNULL(Weather,'')

ISNULL(变量,需要替换的值),判定:如果变量为null值,则将值替换为后面的值

<Statement Id="QueryGlitchInfo">
		  SELECT top (@limit)
		  
		    Id
		  ,OrganizationName
		  ,GroupName
		  ,SubstationName
		  ,LineName
		  ,Weather = ISNULL(Weather,'')
		  ,GlitchType = ISNULL(GlitchType,'')
		  ,TripType = ISNULL(TripType,'')
		  ,TripSwitchName = ISNULL(TripSwitchName,'')
		  ,TripSwitchType = ISNULL(TripSwitchType,'')
		  ,PowerDownTime = ISNULL(PowerDownTime,'')
		  ,PowerUpTime = ISNULL(PowerUpTime,'')
		  ,Coincidence = ISNULL(Coincidence,'')
		  ,FAStart = ISNULL(FAStart,'')
		  ,FASelfHealing = ISNULL(FASelfHealing,'')
		  ,Times = ISNULL(Times,0)
		  ,DownTime = ISNULL(DownTime,'')
		  ,Gongbian = ISNULL(Gongbian,0)
		  ,Zhuanbian = ISNULL(Zhuanbian,0)
		  ,DownCounts
		  ,Description = ISNULL(Description,'')
		  ,Reason1 = ISNULL(Reason1,'')
		  ,Reason2 = ISNULL(Reason2,'')
		  ,Problem1 = ISNULL(Problem1,'')
		  ,FailureReason = ISNULL(FailureReason,'')
		  ,Reason3 = ISNULL(Reason3,'')
		  ,Problem2 = ISNULL(Problem2,'')
		  ,Verified = ISNULL(Verified,'')
		  ,Appeal = ISNULL(Appeal,'')
		  ,Corrective = ISNULL(Corrective,'')
		  ,Implement = ISNULL(Implement,'')
		  ,CompleteTime = ISNULL(CompleteTime,'')
		  ,Evaluate = ISNULL(Evaluate,'')
		  ,Assessment = ISNULL(Assessment,'')


		
		  from (select row_number()
		  over(order by vg.PowerDownTime desc) as rownumber,*
		  from dbo.[VglitchView] vg
		  <Where>
		      vg.OrganizationName in(
				  <For Prepend=""  Property="organization" Separator="," >
					  @organization
				  </For>
				  )
		  <IsNotEmpty Prepend="And" Property="groupName">
			  vg.GroupName LIKE '%'+@groupName+'%'
		  </IsNotEmpty>
		  <IsNotEmpty Prepend="And" Property="substationName">
			  vg.SubstationName LIKE '%'+@substationName+'%'
		  </IsNotEmpty>
		  <IsNotEmpty Prepend="And" Property="lineName">
			  vg.LineName LIKE '%'+@lineName+'%'
		  </IsNotEmpty>
		  <IsNotEmpty Prepend="And" Property="start">
			  vg.PowerDownTime <![CDATA[ >= ]]> @start
		  </IsNotEmpty>
		  <IsNotEmpty Prepend="And" Property="end">
			  vg.PowerDownTime <![CDATA[ <= ]]> @end
		  </IsNotEmpty>
		  <IsNotEmpty Prepend="And" Property="glitchType">
			  vg.GlitchType = @glitchType
		  </IsNotEmpty>
		  <IsNotEmpty Prepend="And" Property="tripType">
			  vg.TripType LIKE '%'+@tripType+'%'
		  </IsNotEmpty>
		   <IsNotEmpty Prepend="And" Property="coincidence">
			  vg.Coincidence = @coincidence
		  </IsNotEmpty>
		  <IsNotEmpty Prepend="And" Property="faSelfHealing">
			  vg.FASelfHealing  = @faSelfHealing
		  </IsNotEmpty>
		  <IsNotEmpty Prepend="And" Property="perorganization">
			  vg.OrganizationName = @perorganization
		  </IsNotEmpty>
	  </Where>
		) temp_row
		<Where>
			rownumber > ((@page-1)*@limit)
		</Where>
	  </Statement>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值