Answers for "postgresql to string"

SQL
1

postgres convert number to string

Because the number can be up to 15 digits, you'll need to cast to an 64 bit (8-byte) integer. Try this:

SELECT * FROM table
WHERE myint = mytext::int8
The :: cast operator is historical but convenient. Postgres also conforms to the SQL standard syntax

myint = cast ( mytext as int8)
If you have literal text you want to compare with an int, cast the int to text:

SELECT * FROM table
WHERE myint::varchar(255) = mytext
Posted by: Guest on March-04-2021
0

postgres json to string

SELECT CAST( json_column AS TEXT ) FROM table
or
SELECT json_column::TEXT FROM table
Posted by: Guest on November-23-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language