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

postgresql casting integer to string

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

PREVIOUS NEXT
Code Example
Sql :: remove binlog mysql 
Sql :: mysql concatenate select results 
Sql :: oracle saurce code 
Sql :: sql missing values 
Sql :: oracle plsql sleep 
Sql :: sqlite3 read only 
Sql :: sql not null 
Sql :: how to delete a record from sqlite in android 
Sql :: postgresql search object in array 
Sql :: alter table add column forigen key mysql 
Sql :: update single sql column 
Sql :: sqlalchemy left join 
Sql :: mysql select if empty result 
Sql :: postgres add column integer 
Sql :: install mysql workbench ubuntu 20.04 
Sql :: create table in mysql 
Sql :: show all database inside postgresql 
Sql :: Alter table add column in SQL Server- NAYCode.com 
Sql :: MySQL server is running with the –secure-file-priv 
Sql :: SQL Server rename foreign key constraint 
Sql :: mysql create database utf8 
Sql :: get current month last date in sql server 
Sql :: oracle apex debug mode 
Sql :: add column text sql after column 
Sql :: if else in plsql 
Sql :: sql select into statement 
Sql :: sql percentage with % rounded down 
Sql :: create mysql database on windows 
Sql :: Msg 241, Level 16, State 1, Line 12 Conversion failed when converting date and/or time from character string. 
Sql :: mysql delete duplicate rows but keep one 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =