关于存储过程中二进制或运算的问题
大家好,请教大家一下,我在存储过程中,需要对两个二进制数进行按位或运算,但是系统报错:“数据类型 binary 和 binary 在 boolean OR 运算符中不兼容。”
请各位高手指教!!!
具体代码如下:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
Alter PROCEDURE [dbo].[CollectSchedulDataMonitor]
@result binary(16) = 0x0000000000000000 output
AS
Declare @PLCId int
Declare @Tagid int
Declare @Value float
Declare @stime datetime
Declare @etime datetime
Declare @countErr int
Declare @count int
Declare @flag binary(16)
Declare @org binary(16)
set @etime=getdate()
set @stime=dateadd(n,-15,@etime)
set @flag = 0x0000000000000001
set @org = 0x0000000000000000
set @PLCId=1
While @PLCId<=10
Begin
set @countErr = 0
set @count = 0
Declare tagidCursor Cursor For
Select Tagid From Controldata.CollectScheduleDataDictionary Where PLCId=@PLCId
Open tagidCursor
Fetch Next From tagidCursor Into @Tagid
While @@FETCH_STATUS = 0
Begin
Declare dataValueCursor Cursor For
Select value From ControLdata.Monitor Where tagid = @Tagid And logtime Between @stime And @etime
Fetch Next From dataValueCursor Into @Value
Open dataValueCursor
While @@FETCH_STATUS =0
Begin
set @count = @count + 1
If @Value = Null
Begin
set @countErr = @countErr + 1
End
Fetch Next From dataValueCursor Into @Value
End