Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Concatenate 3 columns using Client Access Driver from As400 Table

Posted on 2003-03-19
1
Medium Priority
?
2,340 Views
Last Modified: 2008-01-09
I amd using ado and the Client Access ODBC driver to connect to an AS400 and select 3 fields -  T7DT - a numeric data, i.e. 20030320
                   CL - 10 digit CLID, i.e. 9198000001
                   DG - dialed 800 number, i.e. 8001234567

I want to SELECT and concatenate these as a 28 char string.  The IBM concat() function only works with 2 columns; and I stupidly tried

SELECT Concat( Concat(t7dt,cl),dg ) as LINE..... [etc]

What is the correct format?

stan littlefield
0
Comment
Question by:stanl
1 Comment
 
LVL 9

Accepted Solution

by:
yongsing earned 2000 total points
ID: 8171221
The two arguments to the concat() function needs to have the same types of data. If one is numeric and one is characters, then it won't work. What you can do is to cast all the columns to char:

SELECT Concat( Concat(cast(t7dt as char(8)), cast(cl as char(10))), cast(dg as char(10))) as LINE..... [etc]
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question