If I replace the + with || the result is still a SQL0132N error. The issue is that it does not appear that like can be used to reference the contents of a column. Unless someone know a way around this. Even a basic statement like this:
db2 "select * from kt.a a, kt.b b where b.col1 like a.col1"
fails with the same error.
-----Original Message-----
From: Edwards Ed [mailto:db2udbdba-ezmlmshield-x70003537.[Email address protected]
Sent: Thursday, June 28, 2007 3:59 AM
To: LazyDBA Discussion
Subject: RE: Re : Using like with a column name
Well, well, well!
It's p! hehe. How have you been? If it is still not working for you, what would happen if you replace the plus sign (+) with the concatenation sign (||)?
Please take a few minutes to provide feedback on the quality of service you received from our staff. The Department of Education values your feedback as a customer. Commissioner of Education Jeanine Blomberg is committed to continuously assessing and improving the level and quality of services provided to you.Simply use the link below. Thank you in advance for completing the survey.
http://data.fldoe.org/cs/default.cfm?staff=Ed.[Email address protected]
-----Original Message-----
From: p [mailto:db2udbdba-ezmlmshield-x22229732.[Email address protected]
Sent: Wednesday, June 27, 2007 4:51 PM
To: LazyDBA Discussion
Subject: Re : Using like with a column name
If I'm mistaken, somebody tell me; but I think in DB2 you would say:
WHERE UserSecurityAttributes.dAttributeName LIKE '%DocumentAccounts.dDocAccount %'
Note that this means you will always get a tablescan to resolve this as no index could be used because of the % front padding.
Hope this helps, Pierre.
----- Message d'origine -----
De: Thompson Keith <db2udbdba-ezmlmshield-x80675655.[Email address protected]
Date: Mercredi, Juin 27, 2007 4:19 pm
Objet: Using like with a column name
À: LazyDBA Discussion <[Email address protected]
> I need to convert some SQL server sql to db2. The sql I am starting
> with looks like this:
>
> WHERE (UserSecurityAttributes.dAttributeName LIKE '%' +
> DocumentAccounts.dDocAccount + '%')
>
> They are trying to allow padding of extra characters on either side of
> the column name. DB2 returns the error below when a like is used with
> a column name.
>
> SQL0132N A LIKE predicate or POSSTR scalar function is not valid
> because the first operand is not a string expression or the second
> operand is not a string. SQLSTATE=42824
>
> Is there another way to do this in db2?
>
> Thanks,
>
> Keith
>
>
> -----------------------------------------------------------------
> ----
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post
> a dba job: http://jobs.lazydba.com To Subscribe :
> http://www.LazyDBA.com To unsubscribe:
> http://www.lazydba.com/unsubscribe.html
>
>
Pierre Saint-Jacques
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post a dba job: http://jobs.lazydba.com To Subscribe : http://www.LazyDBA.com To unsubscribe: http://www.lazydba.com/unsubscribe.html
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post a dba job: http://jobs.lazydba.com To Subscribe : http://www.LazyDBA.com To unsubscribe: http://www.lazydba.com/unsubscribe.html
DB2 & UDB email list listserv db2-l LazyDBA home page