Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subquery with INSERT
Message
 
To
27/08/2009 12:54:17
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01421215
Message ID:
01421216
Views:
43
>Is it possible to use a subquery to return the KeyID of a newly INSERTed record? Something like this:
>
>&& pseudo code
>select max(keyid) from (insert into tip (st_name) values ('test'))
>
>What would be the syntax?
>Thanks


Nope,
To use derived tables the commands must returns result set. INSERT and DELETE commands didn't do that.
So you must separate these commands in two different queries.

BTW what version of VFP and what s the type of KeyID field (is it AUTOINC or not?)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform