In this example, all the data in the object store identified by the LOCATION is loaded into the database. This allows the columns to be referenced without using DOT notation and allows you to cast the fields to appropriate data types.
The examples and results show a sample river flow data set. To use your own data, replace the table and column names, and authorization object.
- To run NOS-related commands, log on to the database as a user with the required privileges.
Create and load the table:
CREATE MULTISET TABLE riverflowperm_csv AS ( SELECT CAST(payload..site_no AS CHAR(8)) Site_no, CAST(payload..Flow AS FLOAT) Flow, CAST(payload..GageHeight AS FLOAT) GageHeight1, CAST(payload..Precipitation AS FLOAT) Precipitation, CAST(payload..Temp AS FLOAT) Temperature, CAST(payload..Velocity AS FLOAT) Velocity FROM READ_NOS_FM ( ON (SELECT CAST(NULL AS DATASET STORAGE FORMAT CSV)) USING LOCATION('YOUR-STORAGE-ACCOUNT') ) AS D ) WITH DATA;
See Variable Substitutions for Examples for the credentials and location values for the sample river flow data set.
Show the number of rows in the table:
SELECT COUNT (*) FROM riverflowperm_csv;
Your result will be similar to the following:
Count(*) ----------- 36301