I cannot find any equivalent datatype for SQL_Variant in potgresql. Sql_variant is available in sql server. I am new to postgres and presently migrating from sql server to postgres.
There is no such data type in PostgreSQL.
You can either use several attributes, one for each possible type (and maybe a CHECK
constraint that assures that exactly one of them is NOT NULL
) or store binary data (type bytea
) and convert them to whatever data type you need in the application.
Here is about sql_variant
link sql_variant (Transact-SQL)
I would say the closest you could get is to declare a text column and store the string representations of the values.
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