Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AcuODBC

Status
Not open for further replies.

jimmyCRACKcorn

Programmer
Nov 14, 2003
10
0
0
CA
I am trying to extract two fields as one from vb using AcuODBC. The select i'm doing is below:

ADO_Sql = "SELECT FIELD1 + FIELD2 FROM TABLE"

When i try to execute this statement i get an error because of the + sign. Any ideas how combine to fields from a select
 
You have to check the RDBMS documentation for the concatenation operator.
You may try this:
FIELD1 || FIELD2
Or this:
FIELD1 & FIELD2

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I do not know about vb, but with oracle I use double pipe sign : ||
example :
ADO_Sql = "SELECT FIELD1||FIELD2 FROM TABLE"

You can also extract these two filds separately and then concatenate them with cobol.

Regards
Erminio
 
None of these constructs are in the ODBC SQL grammar. Your AcuODBC reference manual should show you the allowable grammar, including the particular means of concatenating two column values from a row. For example, it might be something like
Code:
SELECT CONCAT (FIELD1, FIELD2) AS COLUMN_NAME FROM TABLE

Tom Morrison
 
What you're probably missing is some casting to ensure that both fields are of the same type when they get concatenated:

Code:
SELECT 
(CAST(FIELD1 AS CHAR(100)) + CAST(FIELD2 AS CHAR(100))) AS FIELD3
FROM TABLENAME

.DaviD.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top