[SQL] please help me with text cast to int ....

2004-07-11 Thread Theodore Petrosky
I give up.. what don't I understand about casting and ints and text.. i have a table jobinfo with: acode text, jobnumber text default nextval('public.jobinfo_seq'::text), jobtitle text I have about 3000 rows starting with jobnumber = 1000. SELECT jobnumber, jobtitle FROM jobinfo WHERE jobnumb

Re: [SQL] please help me with text cast to int ....

2004-07-11 Thread Phil Endecott
Theodore, Because jobnumber is declared as text, you are getting "dictionary order" (lexicographic) ordering on the values. In a dictionary, "abc" comes after "a", obviously. So indeed "999" will come after "1000". To get the effect that you want you need to treat jobnumber as a numb

Re: [SQL] please help me with text cast to int ....

2004-07-11 Thread Stephan Szabo
On Sun, 11 Jul 2004, Theodore Petrosky wrote: > I give up.. what don't I understand about casting and > ints and text.. > > i have a table jobinfo with: > > acode text, > jobnumber text default > nextval('public.jobinfo_seq'::text), > jobtitle text > > I have about 3000 rows starting with jobnumb

Re: [SQL] please help me with text cast to int ....

2004-07-11 Thread Theodore Petrosky
Thank you this pointed me to the problem. I have non castable entries. I had picked up legacy data (for the jobnumbers [that's why they were text in the first place]) and some of the jobnumbers where 1162_01 1162_02 so this would fail. The error message was giving me the correct message h