Announcement

Collapse
No announcement yet.

Flag-Bits in einem Integer mit SQL auswerten

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Flag-Bits in einem Integer mit SQL auswerten

    Hallo,
    Gibt es eine Möglichkeit einzelne Bits eines Integer-Feldes mit SQL auszuwerten?

    Alex

  • #2
    <pre>
    SELECT * FROM mytable
    WHERE MOD(CONVERT(FLOOR(myfield/POWER(2,n-1)),SQL_INTEGER),2)=1
    </pre>

    Liefert alle Datensätze, welche in myfield das Bit 'n' gesetzt habe

    Comment


    • #3
      Danke.
      ale

      Comment

      Working...
      X