Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language 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 July 6th, 2006, 12:19 PM
Authorized User
 
Join Date: Dec 2005
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to g_vamsi_krish
Default Altering the Identity seed value

ALTER TABLE tblname ALTER COLUMN col_name INT (101,1) IDENTITY NOT NULL

Error : Incorrect syntax near the keyword 'IDENTITY'.

Please help me to figure out this correct syntax....

Thanks,
Vamsi

vamsi
__________________
vamsi Krishna G
mobile: 91 + 9986023966.
124 Puttappa layout new Tippasandhra,
bangalore.
Inida
 
Old July 6th, 2006, 01:00 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

This is the SQL Language forum. Your question concerns what some implementations' DDL can and cannot do about the IDENTITY property, something unique to specific RDBMS implementations.

That having been said, if you are talking about SQL Server, I think you have a couple things wrong with your attempt.

The syntax for defining the IDENTITY property is IDENTITY(<seed>, <incr>) and not the way you have written it.

The real problem, though, is that you cannot alter a column with the IDENTITY property this way. The IDENTITY(<seed>, <incr>) expression can only be specified when you ADD a column. It cannot be changed via DDL this way once the column exists.

In SQL Server, you can use the DBCC CHECKIDENT utility command to change an Identity column's seed value, as:

    DBCC CHECKIDENT('yourtable', RESEED, <newseed>)

I don't know of a way to change the increment value without dropping then readding the column.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
 
Old July 7th, 2006, 12:58 AM
Authorized User
 
Join Date: Dec 2005
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to g_vamsi_krish
Default

  U'r reply helped me a Lot. thanks for u r solution.

vamsi





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to seed or increment NEWID() value suji SQL Server 2005 4 February 19th, 2008 02:45 PM
random seed? kiw Pro JSP 1 October 31st, 2004 03:27 PM
setting seed for autonumber in access dcary69 Access 1 October 5th, 2004 12:37 PM





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