I do not recommend using this type of data, at least if you are going to use it in applications because it is clear that you will not know what type of data persists
But you will have to return together with the value of what type of data persisted, for that use SQL_VARIANT_PROPERTY
sql_variant (Transact-SQL)
As you will see back
SELECT Empid,
Codigo,
Valor,
SQL_VARIANT_PROPERTY(Valor,'BaseType') AS 'DataType'
FROM Parametros
to have the type of data you will have to apply logic to know what specific type to cast in .net
Having the type of data one could see of making a generic converter
Convert or TryParse from string to T (generic) possible? work around?
public static T TryParse<T>(string inValue)
{
TypeConverter converter =
TypeDescriptor.GetConverter(typeof(T));
return (T)converter.ConvertFromString(null,
CultureInfo.InvariantCulture, inValue);
}
but you have to see how it is that you intend to use the data in the application, maybe use a string for all types of data to be simpler