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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to concatenate string in SQL expression

Status
Not open for further replies.

fancyface

IS-IT--Management
May 17, 2006
104
CA
within my Crystal Version 7 application, how do I build field 1 to field 2 with a hyphen in the middle?
 
You don't need a SQl Expression, try:

{table.field1} & "-" & {table.field2}

I think that in CR 7 you should use the syntax for the database being used, which you didn't post.

-k
 
Thank you for your attempted assistance, HOWEVER, my question was how do I do it in a SQL Expression. I am quite familiar with the formulas but I would like it in a SQL expression. I am using an Oracle 7 ODBC connection. I don't find there is much documentation out there on the syntax to be used in SQL expressions. Can someone else help me please?
 
Is this what you are looking for:

SELECT field1 + "-" + field2 AS comb-field from .....
 
Hi,
The SQL used varies based on what database you are using..SQL is a language with differnet dialects, not a database..


In Oracle, for instance it would be:
select field1||'-'||field2 from table...



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
The issue is that the syntax is dependent upon your datasource, which you have not identified.

-LB
 
Hi,
As an added note, why use ODBC..The Oracle Server ( the native connection) is much more efficient - although I do not know if it is available for such an old and desupported database ( Oracle7?),,( At least desupported by Oracle)

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thank you for your assistance. This is what I was putting:

PS_TBLA."ORG" + '-' + PS_TBLB."DESCR"

and I get an invalid identifier.

Other options I considered were the {fn CONCAT(, )} but I don't know how to get the "-" in there. Or the {fn INSERT(, , , )} but I can't find proper instructions on how to use that.

Thanks again,
 
Hi,
For a Sql expression in Oracle use Oracle's syntax, NOT Crystal's..

Code:
PS_TBLA.ORG || '-' || PS_TBLB.DESCR

Or

Code:
"PS_TBLA"."ORG" || '-' || "PS_TBLB"."DESCR"

Oracle interprets the + as an arithmatic operator..







[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top