0

I have a table Watchlist that contains a number of players and a flag to idenfity their offenses. I want to implement the flag as a bitmask. However, to catch wrong input at an early stage, I would like to check the bitmask against the table Watchlist_Flags before the value is set.

Basically, I'm looking for an SQL query to verify that the about-to-be set bitmask flag is indeed composed of, and ONLY of, flag IDs present in the table Watchlist_Flags


Is it possible to implement this on an SQL level or do I need to deal with this in the final software?

Ben
  • 99
  • 1
  • 7
  • 1
    This is for SQL Server, but I remember at one stage converting it to MS Access, so it may be of interest: http://sqlblog.com/blogs/denis_gobo/archive/2007/05/29/test.aspx – Fionnuala Jul 13 '12 at 11:02

1 Answers1

1

My suggestion would be to populate a combo box with the values of Watchlist_Flags. Have a user select the value from that combo box, and when adding/updating a record, use the value selected in the SQL statement which adds/updates the data in Watchlist.

EastOfJupiter
  • 781
  • 5
  • 11
  • Because the flags are part of a bitmask, populating a ComboBox with values would be much more work than intended since the ComboBox would have to contain all possible combinations of all flags. – Ben Jul 13 '12 at 16:50
  • I didn't realize there would be several combinations of flags that could be selected. My apologies for offering an inadequate solution. Remou may have a very workable solution, then. – EastOfJupiter Jul 13 '12 at 18:40