Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AutoInc data type
Message
From
16/04/2003 15:44:32
 
 
To
16/04/2003 15:40:18
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00778507
Message ID:
00778561
Views:
22
Thank you for your opinion, I am currently writing an application that needs to connect to either VFP free tables or SQL Server backend, user option. And don't know which is the easiest way to go.





>>I have a field which uses the new AutoInc Integer type, and I would like to get the new ID value after I issue an INSERT INTO statement. Something like @@Identity in SQL Server. Is it possible?
>>
>>
>
>If you know the name of the primary key field:
>
>
>INSERT INTO table1 ....
>? table1.keyID
>
>
>If your program doesn't know the name of the primary key field, see KEY(), TAGCOUNT(), PRIMARY() functions...your code can figure out the name of the primary key field. Then use eval() to get the new key:
>
>For example, assuming the primary key is the first index tag:
>
>lcKeyField = "table1." + key(1)  && you'd have to SELECT the table, and then set the work area back
>? eval(lcKeyField)
>
Previous
Reply
Map
View

Click here to load this message in the networking platform