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

SQL Statement

Status
Not open for further replies.

juergenkemeter

Programmer
Oct 6, 2004
27
NZ

Hi,
I have the following Statement:
------------------------------------
select substring('AE0000000',1,9-Length(cast(prid as varchar(7)))) + cast(prid as varchar(7)) + '/' + substring(cast(pryear as char(4)),3,2)
from hilfssto.proverw
where PRID = [PRID]
--------------------------------------


which produces the following message:
---------------------------
DB2 Table Editor Developer
---------------------------
+ use not valid.
(SQL code = -402, SQL state = 42819)
---------------------------
OK
---------------------------

Can anyone help me in this matter?

Jürgen
 
Hi Jurgen,
I'm assuming that you wish to concatentate. In all versions of DB2 that I have ever used the concatenation function is two straight lines:
||

Hope this helps

Marc
 
Hi Marc,
I have no experience with this function. Can you tell me how my statement would look with this function?

Jürgen
 
Jurgen,
Try:

select substring('AE0000000',1,9-Length(cast(prid as varchar(7)))) ||
cast(prid as varchar(7)) ||
'/' ||
substring(cast(pryear as char(4)),3,2)
from hilfssto.proverw
where PRID = [PRID]

and let me know if that does the trick.
Marc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top