I currently have a database table setup as follows (EAV - business reasons are valid):
The good thing about sql variant is that you can store several types in a column and you keep the type information.
Insert into MySettings values ('Name','MyName'); Insert into MySettings values ('ShouesNumber',45); Insert into MySettings values ('MyDouble',31.32);
If you want to retrieve the type:
select SQL_VARIANT_PROPERTY ( value , 'BaseType' ) as DataType,* from mysettings
and you have:
Datatype Name          Value
-----------------------------
varchar  Name          MyName
int      ShoesNumber   45
numeric  MyDouble      31.32
Unfortunately this has several drawbacks: