TD_ConvertTo Example | ConvertTo | Teradata Vantage - Example: How to Use TD_ConvertTo - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

TD_ConvertTo InputTable: input_table

Every complete example in this document is available in a zip file that you can download. The zip file includes a SQL script file that creates the input tables for the examples. If you are reading this document on https://docs.teradata.com/, you can download the zip file (SQLE-Analytic-Functions-Examples_xxxx) from the attachment in the left pane.

 
  passenger survived pclass  name                                 gender age    sibsp   parch    ticket       fare   	cabin       embarked 
 --------- -------- ------ ------------------------------------  ------  ----   -----   -----
        97        0      1 Goldschmidt; Mr. George B              male     71     0      0        PC 17754    34.6542	A5          	C       
       488        0      1 Kent; Mr. Edward Austin                male     58     0      0        11771       29.7	B37        	C       
       505        1      1 Maioni; Miss. Roberta                  female   16     0      0        110152      86.5 	B79             S       
       631        1      1 Barkworth; Mr. Algernon Henry Wilson   male     80     0      0        27042       30 	A23             S       
       873        0      1 Carlsson; Mr. Frans Olof               male     33     0      0        695         5 	B51 B53 B55     S  

TD_ConvertTo SQL Call

SELECT * FROM TD_ConvertTo (
  ON input_table AS InputTable
  USING
  TargetColumns ('fare')
  TargetDataType ('integer')
) AS dt ORDER BY 1;

TD_ConvertTo Output

passenger survived pclass name                                 gender age sibsp parch ticket   fare cabin       embarked 
--------- -------- ------ ------------------------------------ ------ --- ----- ----- --------
        97        0      1 Goldschmidt; Mr. George B            male    71     0     0 PC 17754   34 A5          C       
       488        0      1 Kent; Mr. Edward Austin              male    58     0     0 11771      29 B37         C       
       505        1      1 Maioni; Miss. Roberta                female  16     0     0 110152     86 B79         S       
       631        1      1 Barkworth; Mr. Algernon Henry Wilson male    80     0     0 27042      30 A23         S       
       873        0      1 Carlsson; Mr. Frans Olof             male    33     0     0 695         5 B51 B53 B55 S