Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 14 Nov 2012 @ 10:30:33 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   What is the use of LIKE operator for char fields
 
From:   jeevanaresh.baskaran

Hi All,

I have a table with ?only one column?Request_Id char(20) and one data 'jeeva' in that column.

Below are the queries I am using and the corresponding output

1. select * from table_name where Request_Id ?= 'jeeva'

Output: jeeva


2. select * from table_name where cast(Request_Id as char(20)) = 'jeeva'

Output: jeeva


3. select * from table_name where Request_Id like '%a'

Output: No Output


4. select * from table_name where trim(Request_Id) like '%a'

Output: jeeva


5. select * from artemis_app.trim_1

Output: jeeva


My question here is why the 3rd query not able to produce any output... For Char(20) excluding those 5 characters if the remaining ?are filled with spaces it should not return any output for the first query itself...

How is this like operator working for char fields?


Thanks,

Jeeva



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023