Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
|
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 16th, 2005, 05:41 AM
Registered User
 
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL query to find key when auto-increment

If I have a table with the primary key set to auto-increment and I just wrote a record to that table... how can I query and get the key?

Sandy

 
Old November 21st, 2005, 10:49 AM
Authorized User
 
Join Date: Sep 2005
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Default

select @@identity or select scope_identity()

“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" -- http://sqlservercode.blogspot.com/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Increment Field Problem in SQL Server 2000 yes_no ASP.NET 1.0 and 1.1 Professional 4 August 11th, 2008 07:10 AM
auto increment primary key jcuga SQL Language 2 June 3rd, 2007 09:04 AM
How to auto increment primary key method SQL Server 2000 5 May 24th, 2005 03:25 PM
How to Auto Generate ID (Primary Key) SQL database havering SQL Server 2000 9 December 1st, 2004 10:38 AM
auto increment primary key-compile error junemo Oracle 2 June 16th, 2004 08:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.