MySQL Forums
Forum List  »  Microsoft SQL Server

Re: Problem with Logical Operators
Posted by: Jose Osman Sansuste Tapia
Date: October 08, 2004 10:23AM

Ok, the Table niveles_accesos have this values:

nvl_codigo | nvl_descripcion
1 Visitas
2 Estudiantes
4 Docentes
8 Administrativos
16 Supervisores
32 Directores

This nvl_codigo is a reference about the levels of access availables

The Table usuarios have this values:

usr_codigo | usr_nombre | nvl_codigo
1 Jose Osman 12
2 Elizabeth 9
3 Marcelo 20
4 Javier 40

This nvl_codigo is sumatory of the levels that have each user, JOSE OSMAN have nvl_codigo = 12, it means that JOSE OSMAN is LEVEL 4 and LEVEL 8, it means that is DOCENTES AND ADMINISTRATIVOS, the sumatory of his levels are 12.

(4+8) = 12

In SQL Server, to know if JOSE OSMAN is Level 16 (SUPERVISORES) i execute this query

SELECT * FROM Parametros.dbo.usuarios
WHERE (nvl_codigo & 16) = 16
AND usr_codigo = 1

If i exeute this SELECT (18 & 16), returns 16, because LEVEL 18 means that is LEVEL 2 + LEVEL 16, so it returns 16, but if i execute SELECT (32 & 16) it returns 0, because 32 does not contain 16 LEVEL.

The question is, how do i get the same result usgin the same tables and data, but using MySQL + ASP (ADO).

Thanks...

Options: ReplyQuote


Subject
Written By
Posted
Re: Problem with Logical Operators
October 08, 2004 10:23AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.