GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Data Warehousing  >  Abinitio

 Print  |  
Question:  What is the function you would use to transfer a string into a decimal?



July 07, 2005 11:11:58 #1
 Ashim Dutta   Member Since: Visitor    Total Comments: N/A 

RE: What is the function you would use to transfer a string into a decimal?
 
In this case no specific function is required if the size of the string and decimal is same. Just use decimal cast with the size in the transform function and will suffice. For example, if the source field is defined as string(8) and the destination as decimal(8) then (say the field name is field1). 
 
out.field :: (decimal(8)) in.field 
 
If the destination field size is lesser than the input then use of string_substring function can be used likie the following. 
say destination field is decimal(5). 
 
out.field :: (decimal(5))string_lrtrim(string_substring(in.field,1,5)) /* string_lrtrim used to trim leading and trailing spaces */ 
 
Hope this solution works.
     

 

Back To Question