Create View of Foreign Table - Teradata Vantage - Analytics Database

SQL Data Definition Language Syntax and Examples

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-11-06
dita:mapPath
jco1628111346878.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
mdr1472255012272
lifecycle
latest
Product Category
Teradata Vantage™

This statement defines a view that includes selected columns cast to appropriate data types.

CREATE VIEW riverflow_csv_v AS (
  SELECT
  CAST(datetime AS VARCHAR(20)) datetime,
  CAST(site_no AS CHAR(8)) Site_no,
  CAST(Flow AS FLOAT) Flow,
  CAST(GageHeight AS FLOAT) GageHeight,
  CAST(GageHeight2 AS FLOAT) GageHeight2,
  CAST(Precipitation AS FLOAT) Precipitation
  FROM riverflow_csv
);

The following statement shows the new view:

SELECT * FROM riverflow_csv_v;
 
datetime          Site_no                    Flow              GageHeight  GageHeight2          Precipitation
----------------  --------  ---------------------  ----------------------  -----------  ---------------------
2018-06-29 00:00  9400815   0.00000000000000E 000  -1.00000000000000E-002            ?  0.00000000000000E 000
2018-07-02 14:35  9429070                       ?                       ?            ?  1.16000000000000E 000
2018-07-01 00:00  9400815   0.00000000000000E 000  -1.00000000000000E-002            ?  0.00000000000000E 000
2018-07-02 00:00  9400815   0.00000000000000E 000  -1.00000000000000E-002            ?  0.00000000000000E 000
2018-07-12 00:00  9400815   0.00000000000000E 000  -1.00000000000000E-002            ?  0.00000000000000E 000
2018-07-10 00:00  9400815   0.00000000000000E 000  -1.00000000000000E-002            ?  0.00000000000000E 000
2018-07-09 00:00  9400815   0.00000000000000E 000  -1.00000000000000E-002            ?  0.00000000000000E 000
2018-07-08 00:00  9400815   0.00000000000000E 000  -1.00000000000000E-002            ?  0.00000000000000E 000
2018-06-29 00:15  9400815   0.00000000000000E 000  -1.00000000000000E-002            ?  0.00000000000000E 000
2018-07-02 14:36  9429070                       ?                       ?            ?  1.09000000000000E 000