PDA

View Full Version : Append automem with vt



phabio
2019-08-30, 14:16
Hi all, I've a virtual table pointing to mssql table.
I need to insert a new record on the remote table.
Can I use append automem?
Thank
Fabio

josipradnik
2019-08-31, 13:03
Hi Fabio,

I susspected the answer is not, but when created a virtual table, local, and tried


store automem
append automem


it worked.
I don't know if remote will do. Try APPEND BLANK first.

phabio
2019-08-31, 20:01
Hi Josip, thanks.
But I've more "not null" fields..
Now I've some error on this fields.

barrymavin
2019-09-01, 01:42
As you don't properly describe what error is reported and don't try it but rather ask others to try for you it's difficult to know what it is you are wanting to achieve. However, you can also use the sql insert command with the memvar keyword.

https://www.lianja.com/doc/index.php/SQL_INSERT

josipradnik
2019-09-01, 01:52
Hi Fabio,

If you have "not null" fields, then it is understandable.
I suppose you tried APPEND BLANK with remote VT to get these errors.
APPEND BLANK was just an idea to check if such non-SQL concept works in remote VT like in local VT.

For APPEND AUTOMEM (if it works in remote) you need to assign some new values for unique key fields
and provide not null values for such fields



store automem
m.account_no = strzero(seqno(),5)
append automem
https://www.lianja.com/doc/index.php/APPEND_AUTOMEM

barrymavin
2019-09-01, 02:00
As has been discussed on various occasions if your remote table has autoinc columns or other auto generated columns you need to exclude those columns from the virtual table definition using the updatefieldlist property.

https://www.lianja.com/doc/index.php/Virtual_Table_Properties

phabio
2019-09-03, 02:29
Hi all,
now I've solved with a direct insert into MSSQL via sqlexec and work.
In the next days I try again with append automem and insert SQL.
thanks
Fabio