Reputation: 33754
There is unknown type (but it's possible to check it before store) (abstract type) data I need to store. I can see two variants of storing it.
Check data type and move to type-specific table. Having many type-specific is not good for abstraction.
Or store everything as variant.
There are will be a lot of data and I afraid that saving Boolean-typed data into sql_variant will cause excessive memory waste. Is it so?
Is there any other solutions for such situation?
Upvotes: 0
Views: 198
Reputation: 533
It's hard to determine right answer from your question.
What data types you are expecting to be and what are you going to do with that types?
Because,if you are going to create to many tables for each type you will end up in complexity and more size on disk than using sql_variant type. Keep in mind that when using sql_variant to represent boolean, will only represent 1 byte of overhead(for storing data type kind) + variable length bytes(wich you probably already have in table). But if you are using that type fore some complex mission critical logic and if yours data access framework doesn't support sql_variant you should not use sql_variant.
Upvotes: 1