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 February 14th, 2005, 05:40 AM
Registered User
 
Join Date: Feb 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kinshuk
Default ASP program How to add new ID for new record

I am doing programming in ASP and database is SQL Server I am finding problem in ID field This should be autogenerate and increment by 1. Please anyone can help me for the same.
 
Old February 14th, 2005, 06:09 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

You can make the column into an Identity column with increment step as 1.

Use your enterprise manager for this.
 
Old March 7th, 2005, 01:12 AM
Authorized User
 
Join Date: Feb 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

SQL Statement to create auto-generated ID field:

CREATE TABLE [MyTable] (
    [ID] [int] IDENTITY (1, 1) NOT NULL ,
    [Column1] [varchar] (50) NOT NULL ,
    [Column3] [datetime] NULL
)
GO

Cheers,
Pooja Falor
 
Old March 21st, 2005, 02:43 PM
Registered User
 
Join Date: Jul 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

kinshuk-

In the SQL Server Enterprise Manager, you can click the database you are working with.

Once the DB is open, you can right click the Table name and select "Design Table"

Click on the Column Identity row of the column you would like to set to autogenerate. Select 'Yes' from the dropdown.

-------------------
namaste,

mike






Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP Add New Record and Get ID omninewt Classic ASP Databases 5 April 10th, 2008 12:20 PM
ADD DB RECORD/ RETURN ID Huascar82 Classic ASP Databases 1 October 1st, 2007 11:55 PM
HELP ME to add a record to a database using ASP kumail Classic ASP Databases 3 August 18th, 2005 05:33 AM
why not index.asp?id=1 can be www.myweb.com/?id=1 BurhanKhan Classic ASP Professional 11 September 6th, 2004 02:06 PM
ASP Insert - Get Record ID llowe Classic ASP Databases 2 March 24th, 2004 11:11 AM





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