Integer comparison as string

Posted by J Pollack on Stack Overflow See other posts from Stack Overflow or by J Pollack
Published on 2010-03-24T11:45:30Z Indexed on 2010/03/24 11:53 UTC
Read the original article Hit count: 368

Hi

I have an integer column and I want to find numbers that start with specific digits.

For example they do match if I look for '123':

1234567
123456
1234

They do not match:

23456
112345
0123445

Is the only way to handle the task by converting the Integers into Strings before doing string comparison?

Also I am using Postgre regexp_replace(text, pattern, replacement) on numbers which is very slow and inefficient way doing it.

The case is that I have large amount of data to handle this way and I am looking for the most economical way doing this.

© Stack Overflow or respective owner

Related posts about sql

Related posts about postgresql