4D v19CAST | 
            ||||||||||||||
                 
                
  | 
                
			
                    
                         
    4D v19
 
CAST 
                                
                                
        
 | 
                |||||||||||||
| 
                     CAST (arithmetic_expression AS sql_data_type_name)  | 
		||
The CAST function converts the arithmetic_expression to the sql_data_type_name passed following the AS keyword.
Note: When used to convert an object field into a VARCHAR, a JSON representation of the object is returned.
This example converts the year of the movie into an Integer type:
SELECT Year_of_Movie, Title, Director, Media, Sold_Tickets
FROM MOVIES
WHERE Year_of_Movie >= CAST('1960' AS INT)This example demonstrates converting an object field (Persons.address) into a VARCHAR:
SELECT Persons.name, CAST(Persons.address as VARCHAR) 
FROM Persons
									4D SQL engine implementation
									
									Blog: Read 4D object fields with SQL Engine
									
	Product:  4D
	Theme:  Functions
	
        
        
	
	
	
	
	
	
	
	
	
	4D SQL Reference ( 4D v19)
	
	
Add a comment