Getting all rows from a Table where the column contains only 0
Posted
by Auro
on Stack Overflow
See other posts from Stack Overflow
or by Auro
Published on 2010-04-22T13:18:21Z
Indexed on
2010/04/22
13:33 UTC
Read the original article
Hit count: 123
I got a little problem
i need a sql query that gives all rows back that only contains 0 in it.
the column is defined as varchar2(6) the values in the column looks like this:
0
00
00
100
bc00
000000
00000
my first solution would be like this:
Oracle:
substr('000000' || COLUMN_NAME, -6) = '000000'
SQL Server:
right('000000' + COLUMN_NAME, 6) = '000000'
is there an other way? (it needs to work on both systems)
© Stack Overflow or respective owner