Reply to Re: Return pkID of last saved record - ASPUpload & @@Identity

Your name:

Reply:


Posted by Tony Rogerson on 11/27/05 22:26

You need to use scope_identity(), @@identity is affected by triggers etc...

Tony.

--
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials


"pb648174" <google@webpaul.net> wrote in message
news:1133118993.495847.209820@g47g2000cwa.googlegroups.com...
> After calling the Upload.Save method, loop through the files, saving
> them one at a time. As you save each one, retrieve the @@identity
> property inside the stored proc you are using to insert the new file
> entry. As Celko suggests, You could also use the path and filename as a
> key if you want, since ASPUpload takes care of renaming files if they
> have the same name. Just using an identity column is a heck of alot
> easier though when you have things you want to relate to those files.
>
> Tony Rogerson wrote:
>> Hi,
>>
>> Use SCOPE_IDENTITY() to get the last inserted IDENTITY value for that
>> statement...
>>
>> insert blha......
>>
>> select pkID = SCOPE_IDENTITY()
>>
>> --
>> Tony Rogerson
>> SQL Server MVP
>> http://sqlserverfaq.com - free video tutorials
>>
>>
>> "BigJohnson" <craig.johnson@westleigh.co.uk> wrote in message
>> news:1132937707.195947.101060@g49g2000cwa.googlegroups.com...
>> > We're using ASPUpload as a tool to upload files to our server and save
>> > the details to SQLServer. However, I have an application where I need
>> > to return the pkID of the just saved file. I'm assuming that I could
>> > use the @@Identity command but cannot get this to function.
>> >
>> > Has anyone used this command with ASPUpload with an success, or any
>> > other methods that could be used?
>> >
>> > Thanks.
>> >
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация