Search
 
SCRIPT & CODE EXAMPLE
 

SQL

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
Comment

postgres type cast to string

SELECT * FROM table WHERE YOUR_INTEGER_VALUE::varchar = 'string';
# or
SELECT * FROM table WHERE cast(YOUR_INTEGER_VALUE as varchar) = 'string';
Comment

postgresql casting integer to string

SELECT * FROM table WHERE cast(YOUR_INTEGER_VALUE as varchar) = 'string of numbers'
Comment

PREVIOUS NEXT
Code Example
Sql :: SQL CREATE UNIQUE INDEX for Unique Values 
Sql :: get current month last date in sql server 
Sql :: trim sql oracle 
Sql :: renombrar tabla mysql 
Sql :: sql server locks 
Sql :: mysql delete all except 
Sql :: add current timestamp in mysql 
Sql :: how to extract year from date in sql 
Sql :: current date sql 
Sql :: postgresql add column 
Sql :: alter table id autoincrement 
Sql :: oracle show procedures 
Sql :: java string to sql timestamp 
Sql :: mysql set last_insert_id 
Sql :: mysql show views 
Sql :: remove unique key from a table 
Sql :: date conversion in mysql column 
Sql :: mariadb mysql root access denied 
Sql :: oracle running queries 
Sql :: mysql delete duplicate rows but keep one 
Sql :: kill session inactive oracle 
Sql :: What is dialect for Postgres 
Sql :: how to enable extension in postgreSQL 
Sql :: mysql if null 
Sql :: change mariadb to mysql xampp 
Sql :: mysql backup database command line 
Sql :: sql server date format yyyy-MM-ddThh:mm:ss 
Sql :: sql inner join with where clause 
Sql :: host 127.0 0.1 is not allowed to connect to this mysql server 
Sql :: mysql delete rows 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =