![]() | |
![]() |
| | Thread Tools | Display Modes |
#41
| |||
| |||
|
| EricF 写道: In article <2cipd5-ttt.ln1 (AT) news (DOT) a-kretschmer.de>, Andreas Kretschmer akretschmer (AT) spamfence (DOT) net> wrote: begin RJ wrote: Hi, I'm using postgres sql 8.1x anyone can help convert a character varying to int? I have a table with : attribute | character varying(20) and I need to convert it to numbers so I can do some calculation. tried select cast(privilege.value as int) simple example: test=*# select regexp_replace('abc123def','[^0-9]','','g')::int * 10; ?column? ---------- 1230 end Andreas It's not too clear what you want. If attribute only contains numbers it's easier than Andreas' example: select (CAST(attribute as int) *2) from ... Eric Hi, Thanks, I just get regexp_replace working!!!! your guys are best! Glad you got the regex working. I'm surprised the cast didn't. I tried it on |
#42
| |||
| |||
|
|
Thanks, I just get regexp_replace working!!!! your guys are best! Glad you got the regex working. I'm surprised the cast didn't. I tried it on 8.3 , only the table was missing from the code snippet. |
|
it shows: ERROR: invalid input syntax for integer: "DENY" `---- |
#43
| |||
| |||
|
|
Thanks, I just get regexp_replace working!!!! your guys are best! Glad you got the regex working. I'm surprised the cast didn't. I tried it on 8.3 , only the table was missing from the code snippet. |
|
it shows: ERROR: invalid input syntax for integer: "DENY" `---- |
#44
| |||
| |||
|
|
Thanks, I just get regexp_replace working!!!! your guys are best! Glad you got the regex working. I'm surprised the cast didn't. I tried it on 8.3 , only the table was missing from the code snippet. |
|
it shows: ERROR: invalid input syntax for integer: "DENY" `---- |
#45
| |||
| |||
|
|
Thanks, I just get regexp_replace working!!!! your guys are best! Glad you got the regex working. I'm surprised the cast didn't. I tried it on 8.3 , only the table was missing from the code snippet. |
|
it shows: ERROR: invalid input syntax for integer: "DENY" `---- |
#46
| |||
| |||
|
|
Thanks, I just get regexp_replace working!!!! your guys are best! Glad you got the regex working. I'm surprised the cast didn't. I tried it on 8.3 , only the table was missing from the code snippet. |
|
it shows: ERROR: invalid input syntax for integer: "DENY" `---- |
#47
| |||
| |||
|
|
Thanks, I just get regexp_replace working!!!! your guys are best! Glad you got the regex working. I'm surprised the cast didn't. I tried it on 8.3 , only the table was missing from the code snippet. |
|
it shows: ERROR: invalid input syntax for integer: "DENY" `---- |
#48
| |||
| |||
|
|
Thanks, I just get regexp_replace working!!!! your guys are best! Glad you got the regex working. I'm surprised the cast didn't. I tried it on 8.3 , only the table was missing from the code snippet. |
|
it shows: ERROR: invalid input syntax for integer: "DENY" `---- |
#49
| |||
| |||
|
|
Thanks, I just get regexp_replace working!!!! your guys are best! Glad you got the regex working. I'm surprised the cast didn't. I tried it on 8.3 , only the table was missing from the code snippet. |
|
it shows: ERROR: invalid input syntax for integer: "DENY" `---- |
![]() |
| Thread Tools | |
| Display Modes | |
| |