Re: [SQL] Determine length of numeric field

2011-02-19 Thread Jasen Betts
On 2011-02-15, Tony Capobianco wrote: > I'm altering datatypes in several tables from numeric to integer. In > doing so, I get the following error: > > dw=# \d uniq_hits > Table "support.uniq_hits" >Column | Type | Modifiers > +-+--- > sourceid | numer

Re: [SQL] Determine length of numeric field

2011-02-15 Thread Tony Capobianco
Tom, That's a frighteningly easy solution. Thanks. Tony On Tue, 2011-02-15 at 16:10 -0500, Tom Lane wrote: > Tony Capobianco writes: > > I'm altering datatypes in several tables from numeric to integer. In > > doing so, I get the following error: > > > dw=# \d uniq_hits > > Table "support.u

Re: [SQL] Determine length of numeric field

2011-02-15 Thread Tom Lane
Tony Capobianco writes: > I'm altering datatypes in several tables from numeric to integer. In > doing so, I get the following error: > dw=# \d uniq_hits > Table "support.uniq_hits" >Column | Type | Modifiers > +-+--- > sourceid | numeric | > hitdat

Re: [SQL] Determine length of numeric field

2011-02-15 Thread Tony Capobianco
Pavel, That's perfect! Thanks. Tony On Tue, 2011-02-15 at 22:04 +0100, Pavel Stehule wrote: > Hello > > probably you have to use a explicit cast > > postgres=# select length(10::numeric::text); > length > > 2 > (1 row) > > Regards > > Pavel Stehule > > 2011/2/15 Tony Capobianc

Re: [SQL] Determine length of numeric field

2011-02-15 Thread Peter Steinheuser
In Oracle you never have to cast, in Postgres it's pretty common. See the doc on String Operators and Functions also: http://www.postgresql.org/docs/8.4/interactive/functions-string.html On Tue, Feb 15, 2011 at 3:48 PM, Tony Capobianco wrote: > I'm altering datatypes in several tables from nume

Re: [SQL] Determine length of numeric field

2011-02-15 Thread Pavel Stehule
Hello probably you have to use a explicit cast postgres=# select length(10::numeric::text); length 2 (1 row) Regards Pavel Stehule 2011/2/15 Tony Capobianco : > I'm altering datatypes in several tables from numeric to integer.  In > doing so, I get the following error: > > dw=#

[SQL] Determine length of numeric field

2011-02-15 Thread Tony Capobianco
I'm altering datatypes in several tables from numeric to integer. In doing so, I get the following error: dw=# \d uniq_hits Table "support.uniq_hits" Column | Type | Modifiers +-+--- sourceid | numeric | hitdate| date| total | numeric |