I am designing a database using MSSQL server 2005 to store log values from different devices. The datatype of the values can be boolean, int-32 or 64 bit-double
There will be a lookup table called channels
:
ID(PK) | int32
device_name | varchar(32)
There will be a table called values
to store the value. So boolean and int-32, double values will be casted to DECIMAL datatype.
ID(foreign key to ID@channels) | int32
logtime | DATETIME
value | DECIMAL
The reason I do that is the end user can select data using a simple select statement on one table, such as
select logtime,value from values where ID = 1
without knowing the datatype of the channel.
But this is waste of memory, since now I stored int32 and boolean to Decimal. I am new to database programming, I wonder if anyone know a better way to do this?