General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>>I may be all wrong or doing something wrong, so I need some help. I have created some tables in a database and have iid in most of the tables. In the default of each of these tables for my iid field I have getkey('tablename') to retrieve my next unique key value. This works fine when at the command prompt I type append, my new key is generated and everything works as its suppose to, but in my program I use 'insert into' and the key is not generated. Is this right? How do I retreive my next key for my 'insert into' or should I just append blank and gather?
>>
>>TIA
>>Ron
>
>Are you using INSERT INTO MyTable FROM MEMVAR or SQL INSERT INTO?
>
>If you are using INSERT INTO FROM MEMVAR, and you have a variable m.iid defined, this value will obviously go in there, even if it is blank or zero. This has caught me once or twice.
>
>If you are using SQL INSERT, only the fields you name in the clause should go into the table, and all others should be allowed to take their default values.
Thanks Erik, I found that is what I am doing. insert into from memvar. I have done a few tests and fing that if I do not have a m.iid, it works right, but if I make m.iid = 100, then 100 is saved with the record. Thanks, that helps clear it up.
Ron
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only