Im struggeling with the vdo file syntax:
I want to use the INSERT INTO tablename(field1,field2,field3…) VALUES(value1,valu2,value3…) to write data to a table.
How would a complete vdo file look like vhen I have a modell variables var1 and var2 that should be written to a table called tabletest with fields Tid (for time value), data1 (for var1 value) and data2 (for var2 value)?
VDO syntax
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
for what you are trying to do it may be easiest to simply export the dataset to a tab delimited file using a VDF2TAB command. Otherwise you will need to write to a table containing variable name (or index) a variable value and a time value than use SQL commands to consolidate that into a single table.
In the DSS manual Chap 14, Action keywords it says:
:INSERT tablename
Output Only: Specifies that the values will be put to the database using an INSERT statement (as opposed to an UPDATE statement). The insert statement will take the form
INSERT INTO tablename(field1,field2,field3…) VALUES(value1,valu2,value3…)
Where the field value combinations come from the :FIELD, :VAR, :SUB and possibly :TIME lines.
Isnt this a discripton of an insert with multiple fields?
:INSERT tablename
Output Only: Specifies that the values will be put to the database using an INSERT statement (as opposed to an UPDATE statement). The insert statement will take the form
INSERT INTO tablename(field1,field2,field3…) VALUES(value1,valu2,value3…)
Where the field value combinations come from the :FIELD, :VAR, :SUB and possibly :TIME lines.
Isnt this a discripton of an insert with multiple fields?
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
Each variable to be output will generate an insert statement, so there is no way to combine multiple variable values into a single VDO INSERT statement. It is possible to update a single entry in a table by using :TIME #20 and :VARNAME #literal but you will need to repeat this statement for all times with a matching :FIELD timefieldindatabase=20
There is not currently any wildcard mechanism to populate field values with model results - only ! is used as a substitute for the current run name.
There is not currently any wildcard mechanism to populate field values with model results - only ! is used as a substitute for the current run name.