Re: Converting a number to Text





chaboch wrote:
Hi,

I'm having a tough time with my SQL statement when I try to join two
table. One table has a field named doc_no and is numeric while the
other table has a field named record_key and is text. When i write
"doc_no = record_key" and run the report, I get an error message about
data types not being equal.

How can I force the doc_no to be casted as text so I can join the
tables?

Please Help. Thank You,

Chaim Bochner

You are stuffed! text is a dumb blob type and there isn't much you can do with
it. Not even cast it.
If you can make record_key a (say) lvarchar, or even a char (I am guessing
your text is not very long, if all you expect to do with it is to compare it
with integers), then you can join the two tables with no other requirement.

A word of warning: comparing different data types (and in particular, casting
every single row to an integer) may be a rather inefficient business

--
Ciao,
Marco
______________________________________________________________________________
Marco Greco /UK /IBM Standard disclaimers apply!

Structured Query Scripting Language http://www.4glworks.com/sqsl.htm
4glworks http://www.4glworks.com
Informix on Linux http://www.4glworks.com/ifmxlinux.htm
.



Relevant Pages

  • Converting a number to Text
    ... I'm having a tough time with my SQL statement when I try to join two ... data types not being equal. ... Chaim Bochner ...
    (comp.databases.informix)
  • Re: compare text files
    ... Thing is that I need to compare each record by the primary key ... (CodeNumber) ... always have the same number of fields with the same data types, ...
    (microsoft.public.vb.general.discussion)
  • Re: I just dont get it
    ... Those are different data types - you are comparing a tuple with a ... If Python started trying to guess your intentions, ... I might have gone with 'it makes no sense to compare ... Steve Horne steve at ninereeds dot fsnet dot co dot uk ...
    (comp.lang.python)
  • Re: Inserting empty items into a field.
    ... DENSITY] are double data types.) ... empty/null. ... deleting the entry in those fields but how do I do it with the SQL statement. ... MVP ...
    (microsoft.public.access.modulesdaovba)
  • Insert problem !!
    ... I am having an insert problem with values of different data types. ... table with String int & decimal data types. ... trouble building the SQL statement ...
    (microsoft.public.dotnet.framework.adonet)