myLittleTools Community Forum

Welcome Guest Search | Active Topics | Members | Log In | Register

how do I change the Identity Specification on an existing column Options · View
david220
Posted: Sunday, February 25, 2007 7:01:07 PM
Rank: Newbie
Groups: Member

Joined: 2/18/2007
Posts: 2
Points: 0
hi

I need to change the Identity Specification (Identity Seed 1, Identity Increment 1)on a column with data already on it, Ive tried clicking on modify, properties and extend properties. for some reason you cant change it

I notice when you make a new column you can change the Identity Specification however when I do this I can't copy data in to it.

thanks
dave

elian
Posted: Monday, February 26, 2007 8:10:36 AM

Rank: Administration
Groups: Administration

Joined: 9/11/2006
Posts: 605
Points: 649
Location: Enghien Les Bains, France
Unfortunately, there is no easy way to modify identity specification as there is no SP or T-SQL that would allow modifying these properties.

You can define these properties while creating the column. In order to copy data on an indentity column you must use the SET IDENTITY_INSERT tblName ON command.

Example:
Code:
SET IDENTITY_INSERT [dbo].[Company] ON

INSERT INTO [dbo].[Company] ([id], [Name], [Address], [Address2], [ZipCode], [City], [State], [Country], [Phone], [Web]) VALUES (1, 'Acme Inc.', '102 st. WE', NULL, '001-0023', 'New York', NULL, 'United States', NULL, 'http://www.acme.net')

SET IDENTITY_INSERT [dbo].[Company] OFF


Hope this helps
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

Theme created by myLittleTools
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.