January 17, 2006 at 8:00 pm
Hi
I am writing some vbscript tasks in a dts package and want to use the NOT function. However it does not appear in the list of functions available. If I do use it in the script I get no parsing errors but it does not do what I want. Anyone have any idea if it is possible to do the following in dts:
If NOT
as this is what I want to achieve.
Thanks in advance.
ppamco
January 17, 2006 at 10:23 pm
What exactly are you trying to do ?
I just tested this in an ActiveX script task and it works fine:
Function Main()
If Not ("Apples" = "Oranges") Then
MsgBox "NOT works !!"
End If
Main = DTSTaskExecResult_Success
End Function
January 19, 2006 at 7:23 am
'NOT' doesn't show up in the function list because it is not actually a function, but a (boolean) operator like 'AND' and 'OR'.
As PW showed above it is used to negate the boolean result of an expression, especially useful for If statements.
If Not (a > b + 3) Then
' Do something when (a) less than or equal to (b + 3)
End If
In any case, the NOT operator requires a statement to follow it which results in a boolean expression, which is then negated/inverted.
January 19, 2006 at 9:05 am
Not would more correctly be described as a logical operator. It will give you the bit-wise inverse of the expression that itt applies to. So, if A = 1, Not A will not be zero.
You need to be careful when writing an expression using not that the expression really returns either 0 or -1.
So long, and thanks for all the fish,
Russell Shilling, MCDBA, MCSA 2K3, MCSE 2K3
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply