Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Primary Key not showing

Author  Topic 

andrewcw
Posting Yak Master

133 Posts

Posted - 2005-11-25 : 01:20:07
I am using the Server Explorer in VS2005. I have created an additional field in a small test table with 3 other fields. The new field called foo_key does not show up when I query the table ( it has 7 records ).

I have some tables that I'd like to insert an auto-incrementing integer primary key. But at this point I cant figure out what's wrong. I have toggled the field as primary key on and off.It seems if I create a new table, then I see the primary key field and its autoincrementing as desired.

Could it be that I cannot add such a field if my table already has some records ? ...and to get one in would mean rebuilding a new table and shifting the records....pls advise



andrewcw

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2005-11-25 : 10:51:58
No, you can add identity columns to an existing table. The problem you experiencing is related to VS2005's Server Explorer, not SQL Server.
Chances are, Server Explorer records what it expects the result set to look like and assumes that it is the same each time unless you refresh it in some way. Chech your Server Explorer documentation.
Go to Top of Page

andrewcw
Posting Yak Master

133 Posts

Posted - 2005-11-25 : 12:01:34
Yes, you are correct. I restarted the server explorer and noticed that the query for all had changed to the columns less the key column, I added that - and everything was there. Thanks

andrewcw
Go to Top of Page
   

- Advertisement -