![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I read the regEx dev works article and others online. Nothing speaks about any special treatment the underscore(_) character gets in DB2, yet when I give the following command : * select tabname from syscat.tables where tabschema='CCDB' AND TABNAME LIKE '%_2' WITH UR; Arunz_VW2 I don't need this table to be included. All I needed to know was how many tables were like 'Arun_2' etc. I got around using the sub-string with the length function, but really wanted to know why the '_' char in the Like condition was getting an un-documented(plz link if it in fact is) special treatment. |
#3
| |||
| |||
|
|
On Monday, August 6, 2012 9:35:14 PM UTC+2, Arun Srini wrote: I read the regEx dev works article and others online. Nothing speaks about any special treatment the underscore(_) character gets in DB2, yet when I give the following command : * select tabname from syscat.tables where tabschema='CCDB' AND TABNAME LIKE '%_2' WITH UR; Arunz_VW2 I don't need this table to be included. All I needed to know was how many tables were like 'Arun_2' etc. I got around using the sub-string with the length function, but really wanted to know why the '_' char in the Like condition was getting an un-documented(plz link if it in fact is) special treatment. The use of the underscore character is documented: http://publib.boulder.ibm.com/infoce.../r0000751.html |
#4
| |||
| |||
|
|
On 2012-08-06 22:20, Frederik Engelen wrote: On Monday, August 6, 2012 9:35:14 PM UTC+2, Arun Srini wrote: I read the regEx dev works article and others online. Nothing speaks about any special treatment the underscore(_) character gets in DB2, yet when I give the following command : * select tabname from syscat.tables where tabschema='CCDB' AND TABNAME LIKE '%_2' WITH UR; Arunz_VW2 I don't need this table to be included. All I needed to know was how many tables were like 'Arun_2' etc. I got around using the sub-string with the length function, but really wanted to know why the '_' char in the Like condition was getting an un-documented(plz link if it in fact is) special treatment. The use of the underscore character is documented: http://publib.boulder.ibm.com/infoce.../r0000751.html In addition, this is how it is defined in sql since - at least - SQL92 (Feature id E061-05). Oracle, MySQL, Postgres and MSSQL all does it the same way: http://www.dba-oracle.com/tips_oracl...characters.htm http://dev.mysql.com/doc/refman/4.1/...functions.html http://www.postgresql.org/docs/8.3/s...-matching.html http://msdn.microsoft.com/en-us/libr...sql.90%29.aspx But, I get the impression that it is not commonly known, and the question is raised every now and then in different forums. There is a nice tool at the mimer site where one can verify a certain construct against SQL92, SQL99 and SQL2003 http://developer.mimer.se/validator HTH /Lennart |
#5
| |||
| |||
|
#6
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |