Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dev:sql:functions:substring [2009/12/06 22:35]
tdo
dev:sql:functions:substring [2012/10/26 14:28] (current)
Line 19: Line 19:
 Required. The FROM start_no is a number indicating the number of characters where in the column or string to start the extraction of the partial string. ​ The start_no ​ Required. The FROM start_no is a number indicating the number of characters where in the column or string to start the extraction of the partial string. ​ The start_no ​
  
-^ String ^  | M | y | | s | r | i | n | g | +^ String ^  | M | y |   ​| s |  t | r | i | n | g | 
-^Position ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |+^Position ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 
 + 
 +If the start_no was 4 in the string above, then '​s'​ would be the first character of the returned substring.
  
 == FOR length == == FOR length ==
Line 27: Line 29:
  
 ===== Example ===== ===== Example =====
-==== Example 1 ====+==== Example 1: Substring of column ​====
 <code SQL> <code SQL>
-select product_no,+  > select product_no,
 SUBSTRING(PRODUCTS.PRODUCT_NO FROM 2 FOR 3) as Sub1,  SUBSTRING(PRODUCTS.PRODUCT_NO FROM 2 FOR 3) as Sub1, 
 SUBSTRING(PRODUCTS.PRODUCT_NO FROM 5) as Sub2 SUBSTRING(PRODUCTS.PRODUCT_NO FROM 5) as Sub2
Line 38: Line 40:
  ​ASUP93541 ​        ​SUP ​       93541  ​ASUP93541 ​        ​SUP ​       93541
  ​BPRI54687 ​        ​PRI ​       54687  ​BPRI54687 ​        ​PRI ​       54687
 +</​code>​
 +==== Example 2: Substring of '​string'​ ====
 +<code SQL>
 +  > SELECT SUBSTRING ('My String'​ from 4) from $omnidex
  
 +SUBSTR
 +------
 +String
 </​code>​ </​code>​
  
  
 {{page>:​bottom_add&​nofooter&​noeditbtn}} {{page>:​bottom_add&​nofooter&​noeditbtn}}
 
Back to top
dev/sql/functions/substring.1260138954.txt.gz · Last modified: 2012/10/26 14:27 (external edit)