?
Solved

Concatenate 3 columns using Client Access Driver from As400 Table

Posted on 2003-03-19
1
Medium Priority
?
2,295 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

770 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