ODBC/Methods/Create
< ODBC
Jump to navigation
Jump to search
ODBC: Data Sources | Handles | Data Driver | Error Messages | API: Connect Read Update Create Bulk Insert Config
To create a new table, use the SQL create command, with a list of the column names and attributes in the new data set. Here we create file test, with columns for name and salary.
First, drop test in case it already exists (the _1 result means the table was not found):
'drop table test' ddsql ch _1
Now create the new file:
'create table test (name char(12),sal numeric)' ddsql ch 0
Add a record:
t=. 'insert into test (name,sal) values (''Neumann,E'',40000)' t ddsql ch 0
Add another record:
t=. 'insert into test (name,sal) values (''James, P'',42000)' t ddsql ch 0
Now read the file:
ddfet _1,~ 'select * from test' ddsel ch +------------+-----+ |Neumann, E |40000| +------------+-----+ |James, P |42000| +------------+-----