datatypes

  • Hi

    I have a sql 2000 database in which i need to join

    fldid datatype int

    to

    productfld datatype text(16)

    the productfld default value = ,

    so it has values eg. 2435

    but also has values eg. 2426,2438,2475

    AND

    the fldid has values eg. 2426

    2438

    is this possible

  • Hi eily,

    quote:


    I have a sql 2000 database in which i need to join

    fldid datatype int

    to

    productfld datatype text(16)

    the productfld default value = ,

    so it has values eg. 2435

    but also has values eg. 2426,2438,2475

    AND

    the fldid has values eg. 2426

    2438


    should be possible. Take a look at CAST or CONVERT in BOL. Lot of information there

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • thanks for that but im pretty new to all that

    is there any pointers to it ?

    cheers

  • I think that:

    CAST(fldid as VARCHAR)+CAST(productfld as VARCHAR)

    will give you the result you are looking for. By using CAST, you are changing them to have the same data types, the + concatenates them.

    Hope this helps?

  • BTW, why are you using text data type for an "id" column? I think as a rule, you should shy away from using text data type in most columns! Char and VarChar can store up to 8KB of texts, which should be more than enough for an "id" column, columns of text data can be used to store ASCII characters longer than 8 KB.

    Search BOL for text data type for more info.

    Search BOL for Cast and Convert for examples of how to use them.

  • no,

    the fldID column is an int datatype

    and the productfld is the text field

  • eily,

    Are you saying that productfld is a comma-delimited list of product ids?


    Cheers,
    - Mark

  • Hi

    yes the productfld is the text field and is comma delimited.

    The values of the productfld = values of fldid where fldid is from the lookup table

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply