Should work like that, at least it does for me. It does look like you have a space before your last % though.
Thanks,
Dave Farnsworth
Database Administrator
Dairyland Healthcare Solutions
P: 320.634.5331
F: 320.634.5315
dave.[Email address protected]
This information is confidential and is for the use of the intended recipient only. Any improper use of this information is strictly prohibited. If you have received this e-mail in error, please reply to the sender immediately and delete this communication.
-----Original Message-----
From: p [mailto:db2udbdba-ezmlmshield-x22229732.[Email address protected]
Sent: Wednesday, June 27, 2007 3: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
DB2 & UDB email list listserv db2-l LazyDBA home page