>How do I convert this VFP code to a SQL stored procedure:
>
>
>PROCEDURE GetNextId(cKeyName)
>
>LOCAL nRetVal
>nRetVal = 0
Just as a heads up but DON'T do pKeys in SQL like VFP. It's so much easier to let the Server do it the servers way. Why keep a kludge like that in a modern backend?
When you start getting into transactions in your SP's you will take a beating. It's the hard lesson in switching that few VFP people get on the front end.
Why lock every insert around a single table? Poor design, unless you like to create bottle necks. Then you can say the db's performance is crap. It's rather that you brought your indy car to a dirt track and you wonder why it's tough to drive.
__Stephen