ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

SBCS to DBCS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SBCS to DBCS

    I was working on a little select statement when i could not figure out why it was not working. Could it have been me? I found out that one of the fields is DBCS.

    So is there a way to convert sbcs to dbcs using sql. I see that dbcs will not go into a sbcs.

    I am trying to do this;
    Code:
    where B.TblVal = Iatrb4
    It is the B.TblVal that is dbcs.

    Thanks.
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

  • #2
    Re: SBCS to DBCS

    Normally SQL compares and converts DBCS and SBCS quite nicely (mutch better than RPG). It even can work with mixed SBCS/DBCS strings.
    But you also can use CAST or the scalar functions CHAR or VARCHAR to convert a DBCS string into an SBCS string.
    To convert an SBCS to a DBCS string you also can use CAST or one of the scalar functions GRAPHIC or VARGRAPHIC into a DBCS string:

    Code:
    Select Cast(MySBCS into VarGraphic(256) CCSID 13488), VarGraphic(MySBCS, 256, 13488)
    From ...
    Birgitta
    Last edited by B.Hauser; September 11, 2012, 11:26 PM.

    Comment

    Working...
    X