Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / IDE / November 2005

Tip: Looking for answers? Try searching our database.

VS2005 DB Tools can't set Identity prop for Primary Key columns?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Todd Brooks - 16 Nov 2005 05:59 GMT
Using VS2005 today I needed to create a test database with a couple of
tables for a quick R&D test.  Instead of opening up SQL Enterprise Tools, I
just used the VS2005 database tools and created a new table.  I added an INT
column named ID and set it as the primary key.  I saved the table.  I then
went back into the designer and expanded the column Identity Specification
and tried to set the Identity property to Yes (true).  It wouldn't let me.
I made sure Allow Nulls was NOT checked and tried again.  Still no go.
Opened up help to:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vdt01/html/d8949b19-3d8a-4b2a-a43c-6926c2aba64d.htm
"How to: Modify Column Identity Properties" and saw this note in the
documentation:
"The identity property can be set only for a column that disallows null
values and whose data type is decimal, int, numeric, smallint, bigint, or
tinyint. Also, it cannot be set for a primary key column."

Thinking I was going senile, I checked other tables I've created in the past
in my SQL instance and then resorted to looking up the Identity property in
the SQL Books Online and found *nothing* in there about not being able to
create a PK with an Ident property.  I mean, I've done this same thing a
billion times in the past...that's the whole point of an identity property,
right?

So why won't the database designer in VS 2005 allow this simple action?

Regards,

todd
[MSFT] - 16 Nov 2005 09:03 GMT
Hello,

I tried your steps with a SQL server 2005 database instance, after create
such a table and save it, I can expand the Identity Specification and set
property "Is Identity" to true. Did you also connect to a SQL server 2005
database or others?

Luke
Todd Brooks - 17 Nov 2005 05:27 GMT
I connected to a SQL Server 2000 Standard Edition instance on the local
workstation.

todd

> Hello,
>
[quoted text clipped - 4 lines]
>
> Luke
[MSFT] - 18 Nov 2005 02:32 GMT
I also test with a SQL server 2000 database and got same result. So, my
question is, can you set the identity property when you create it in
designer or you just cannot change the identity property  after you save
the whole table? Is your account a DBO on the database?

Luke

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.