[SQL] ask syntax sql to get length of field

2006-04-20 Thread Mariya Yuniarti
Here Question :I have table A with structure :       Number   Character(20),   Description   Character(50)I want to get length of field Number (20)What is syntax sql to get length of field ?thx Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.

Re: [SQL] Field length ??

2006-04-20 Thread Markus Schaber
Hi, Louise, Louise Catherine wrote: > Could anyone explain, why the field length must be add by 4 : > result 1 : 10 + 4 =14 > result 2 : 5 + 4 = 9 I guess that it is because all variable length datatypes (and text types are such) internally contain a 4 bytes length field. http://www.postgresql.

Re: [SQL] Moving around in a SQL database

2006-04-20 Thread Florian Reiser
Hello Willem, if its not too much data you could do an select * from table an store the result in an array of rows. Then you can iterate over it. If this is too bloated then create a cursor with: declare (refer to http://www.postgresql.org/docs/8.1/interactive/sql-declare.html ). Then use

[SQL] At time zone madness!

2006-04-20 Thread John Goss
I've been trawling the net trying to find an answer to this, so sorry if this is a common problem - I have tried looking before posting!   My problem is that when trying to SELECT a timestamp using "AT TIME ZONE 'Europe/London", it's subtracting an hour instead of adding it from a column storing UT

Re: [SQL] Field length ??

2006-04-20 Thread Tom Lane
Markus Schaber <[EMAIL PROTECTED]> writes: > Louise Catherine wrote: >> Could anyone explain, why the field length must be add by 4 : > I guess that it is because all variable length datatypes (and text types > are such) internally contain a 4 bytes length field. It's an ancient decision that no

Re: [SQL] ask syntax sql to get length of field

2006-04-20 Thread Bruno Wolff III
On Thu, Apr 20, 2006 at 00:37:08 -0700, Mariya Yuniarti <[EMAIL PROTECTED]> wrote: > Here Question : > > I have table A with structure : > > Number Character(20), >Description Character(50) > > I want to get length of field Number (20) > > What is syntax sql to get l

Re: [SQL] Field length ??

2006-04-20 Thread Frank Bax
At 05:16 AM 4/20/06, Markus Schaber wrote: Hi, Louise, Louise Catherine wrote: > Could anyone explain, why the field length must be add by 4 : > result 1 : 10 + 4 =14 > result 2 : 5 + 4 = 9 I guess that it is because all variable length datatypes (and text types are such) internally contain a

Re: [SQL] Field length ??

2006-04-20 Thread Markus Schaber
Hi, Frank, Frank Bax wrote: > Except that the original fields were neither variable length datatypes, > not type text. > create table test(] > satu char(10), > dua char(5) > ); char is a textual type (in opposite to numeric types), and they are handled as variable

Re: [SQL] Field length ??

2006-04-20 Thread Tom Lane
Markus Schaber <[EMAIL PROTECTED]> writes: > Frank Bax wrote: >> Except that the original fields were neither variable length datatypes, >> not type text. > char is a textual type (in opposite to numeric types), and they are > handled as variable length datatypes internally (even if given a limit)

Re: [SQL] At time zone madness!

2006-04-20 Thread Tom Lane
"John Goss" <[EMAIL PROTECTED]> writes: > My problem is that when trying to SELECT a timestamp using "AT TIME ZONE > 'Europe/London", it's subtracting an hour instead of adding it from a column > storing UTC dates. I think you've got a misunderstanding about the behavior of AT TIME ZONE. It's real