Jump to content

Bear

Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Bear

  • Rank
    Newbie
  1. Bear

    Complex WHERE statement

    So...If Flag is 2 then (Flag & 4)= 0If Flag is 4 then (Flag & 4)=1 In fact the only time it will = 1 is when Flag=4.So in the expresion ... AND (Flag & 4) = 0 would return the same records as ... AND (Flag <> 4) because the selection criteria is "and records where the field 'Flag' is not 4".In testing this theory I did find it interesting that the records returned were the same but they were returned in a different order.Thanks for your help Jerome!!!!
  2. Bear

    Complex WHERE statement

    So (Flag & 4) = 0 is a way of saying Flag <> 4 at a bit level?
  3. Bear

    Complex WHERE statement

    Thanks for the reply. "Flag" is defined in the database as a tinyint with a size of 1.The problem I'm having is that the "and (Flag & 4)=0" clause is allowing the number 2 in the results. The data for "Flag" is 0, 1,2 or 4 and the results returned from this where clause contain 0 & 2. Thanks!Bear
  4. New to w3schools. Great site! I've been throught the SQL tutorial and reference but still have a question for you SQL rockstarts out there In the following statement from a user defined function on MS SQL 2000:where DateWorked >= @DateStart and DateWorked <= @DateEnd and Department='50' and (Flag & 4)=0DateWorked, Department, and Flag are fields in the database. What does the "& 4" do in "(Flag & 4)=0?Thanks,Bear
×
×
  • Create New...