In adition to Stephen's message - there is a function in SQL server
named SCOPE_IDENTITY() which returns the last ID inserted by you, even
if someone else already inserted records.

Select Scope_Identity() As MyLastId

I don't remember exactly when it was introduced, I guess SQL Server
2005, but anyway. Check it out.

On Fri, May 28, 2010 at 4:03 PM, Stephen Russell <[email protected]> wrote:
> On Fri, May 28, 2010 at 7:50 AM, Rafael Copquin <[email protected]> 
> wrote:
>> Thanks Steve, of all people I knew you would reply swiftly (:->)
>>
>> But I still need the "push code into VFP and out"
> ----------------
>
> I thought you already had a picker form that the user can find their
> file, an you just wanted to save it to SQL.
>
> Once you know the file, you just file to string it to a var, mWordFile.
>
> In your SQL statement
>
> "Insert into SecretDocs (UserID, UserFile, CreaUser, ModUser) values
> ("+mUserID+", "+ mWordFile+","+ oApp.UserID +","+ oApp.UserID+")
> select @@IDENTITY"
>
> If any of those are Chr() you will need to pass in ' ' to enclose the
> char() in your statement.
>
> The select @@Identity will give you the LAST ID on this table.
> Warning that it could give you someone else's value in a high velocity
> table, but I doubt that is what you will have.
>
> Does this help?
> --
> Stephen Russell
>
> Sr. Production Systems Programmer
> CIMSgts
>
> 901.246-0159 cell
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to