Results 1 to 3 of 3

Thread: CHAR function

  1. #1
    Join Date
    Sep 2003
    Posts
    17

    Unanswered: CHAR function

    If I use the CHAR function to convert a date field to a text field (CHAR(EFECT_DATE,ISO), and access that field through a linked server on MSSQL Server, i only get values in that field appearing like : 0xF0F0F0F160F0F160F0F1 .

    It would appear that the first '0x' is irrelevant, and then that what should be '3's are replaced with 'F's in some kind of hex translation.

    Anyone know why?

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Is this related to your other thread called "Convert field but retain format"?

    I don't know anything about how a “linked server on MSSQL Server” works, but keep in mind that date fields are stored internally as 4 bytes (in a compressed format) and they should be translated to the desired text format only by the final DBMS that displays the data.

    The internal representation of the data does not have any knowledge of ISO, USA, etc formatting. It is only when the data is displayed (or returned to an application program) that the conversion to text (with dashes, slashes, periods, etc) takes place.

    This assumes that you want MSSQL Server to treat the column as a date and not a text value.

  3. #3
    Join Date
    Feb 2002
    Location
    Germany
    Posts
    141
    Are you selecting your data from a DB2 UDB for zOS/OS390? Your data in hexadecimal format looks like '0001-01-01' and this is the "default" date value that db2 "saves", when a new date column (WITH DEFAULT) is defined in a table which has already data.
    HTH
    Rodney Krick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •