Hi,
I need to insert data into a table with an (database) autogenerated ID using the database connectivity toolkit. After inserting the data I want to read back the newly generated ID.
To make sure I'm always fetching the ID of "my" dataset I would run SQL code like this:
INSERT INTO MyTable (Text)
VALUES ('Hello');
SELECT @@IDENTITY AS 'Identity';
SELECT MAX(ID) FROM MyTable;
If I'm executing this query in LabVIEW in one execution (DB Tools Execute Query.vi), I will not fetch any data from the database. I will have to split it into two executions, as shown in the appended LabVIEW example.
My question: Will I always get "my" ID, or is there a chance someone else may generate a different ID in between the two executions? What effect are the DB Tools Free Object.vi-vis actually have?