Re: and'ing two values
Posted in 1998
Aaron Young wrote:
>
> Informixers,
>
> I am extremely new to Informix and not all that familiar with SQL
> (though I have written a select statement or two in my day)
>
> here's my difficulty
>
> I have a smallint that represents days of the week
> Monday = 1
> Tuesday = 2
> Wednesday = 4
>
> Thus, monday-wednesday = 7 and monday-tuesday = 3
>
> I want to and with the numerical representation of the day to find out
> whether or not today is in the database
>
> example
>
> days
> 7
>
> select * from table where days & 2 != 0>
> now this will work with MSSqlServer (for what that's worth)
>
> how would one implement this in Informix 7.1?
>
> Aaron
I would make your database design first normal form, ie split your 7
attributes you have rolled into one smallint and put them in the 7
separate attributes they belong in. Then you will have a chance of
making SQL work for you.
You could also use Informix Universal Server, which allows you to write
your own functions. Maybe you could write your own logical and function
as a stored procedure?
If you develop for the specific features of MSSQLserver you must expect
non-portability.
--
Peter Lancashire
Information Systems Specialist, Bayer plc
Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK
Tel: +44-1635-562258, Fax: +44-1635-562281
--
If all else fails, read the instructions and the release notes.
Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/