Does any one has an idea of whats the best practice to store an unknown data type in a table. Basically I would need to store types like bit, smallint, int, real and nvarchar in the same "value" column, for later interpretation by a .NET application.
I was trying to achieve the best possible solution not to compromise the performance or growth of the database.
Any suggestions?
Thanks in advance!
You can use these SQL data types to store alphanumeric data: CHAR and NCHAR data types store fixed-length character literals. VARCHAR2 and NVARCHAR2 data types store variable-length character literals. NCHAR and NVARCHAR2 data types store Unicode character data only.
Databases use a special value called NULL to represent missing information.
NULL indicates that the value is unknown. A null value is different from an empty or zero value. No two null values are equal.
Varchar(max) is probably the easiest way to do this.
sql_variant was designed for this purpose so you could use it, but read the Books Online entry to ensure it's going to do what you want.
http://msdn.microsoft.com/en-us/library/ms181071.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With