Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Variable Column Width Table or Alternative

Author  Topic 

exiledAussie
Starting Member

1 Post

Posted - 2011-11-16 : 14:31:39
Hi,

I am working on a c++ statistical analysis program that is to export data to relational databases using ODBC.

We have a models which include domains and utilities, the latter specifying the value to the client of variables in the domain being in particular combinations.

We would like to have a table that specifies these utilities, within a database that can include numerous different models, domains and utilities. But different utilities will be the function of different numbers of variables, so (it seems) we cannot utilise a generic table unless we include numerous, usually redundant, columns, which would be quite annoying to the end user.

Alternatively, we can specify a new table whose name is based on the model - ie Model_X_Utility_1 - for each utility matrix. But this seems to be less that ideal.

What would people suggest?

EA

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-17 : 00:40:22
One option is to choose EAV model where you'll have generic table which stores utilities and variables along with their values as rows inside them

http://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model

Another option if you're on SQL 2008 and above is Sparse columns which will still be different columns but will take very less storage

http://blogs.msdn.com/b/sreekarm/archive/2009/01/08/sparse-columns-in-sql-server-2008.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -