473,503 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL Express confusion...setting primary key?

I have two tables in my SQL Express DB within my application.

On one table, I can right-click on the row and set it to be the primary key.
And it is the primary key.

On the other table, though, when I right click to set the primary key, the
key icon shows up, but it doesnt' update the 'IDENTITY SPECIFICAION' below
in the properties to YES like the other table.

Why is that?

-Darrel
Jan 29 '07 #1
5 1492
they have nothing to do with each other. to make a column an identity
column it must be a numeric column, then you set the property.

-- bruce (sqlwork.com)

darrel wrote:
I have two tables in my SQL Express DB within my application.

On one table, I can right-click on the row and set it to be the primary key.
And it is the primary key.

On the other table, though, when I right click to set the primary key, the
key icon shows up, but it doesnt' update the 'IDENTITY SPECIFICAION' below
in the properties to YES like the other table.

Why is that?

-Darrel

Jan 29 '07 #2
they have nothing to do with each other.

What's the difference between them?
to make a column an identity column it must be a numeric column, then you
set the property.
It's set to 'int' right now, but I still can't change the Identity
Specification for some reason.

-Darrel
Jan 29 '07 #3
A primary key simply means the values in a field need to be unique. An
identity means that the field will have an integer value and will increment.
The two items are often used together, but they don't have to be. For
example, a primary key could be the two-letter abbreviation for all the US
states, there's no need for the records to have an identity row if they
already have a unique value.

Do you have any data in the table that you are trying to create the identity
row on? It could be that you already have null values in the field you are
trying to change. In this case, you can't do that since sql server express
doesn't know how to convert it into an identity. You may have to populate
the field ahead of time with a series of numbers first. Not too hard to do
with SQL, or you can create a new temporary field, set it as an identity and
hit save and hope sql server can fill in the values for you, then delete the
old row and rename the new temporary one to the name of the old, problematic
row.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"darrel" <no*****@nowhere.comwrote in message
news:OC**************@TK2MSFTNGP06.phx.gbl...
>they have nothing to do with each other.

What's the difference between them?
> to make a column an identity column it must be a numeric column, then
you set the property.

It's set to 'int' right now, but I still can't change the Identity
Specification for some reason.

-Darrel

Jan 30 '07 #4
>A primary key simply means the values in a field need to be unique. An
>identity means that the field will have an integer value and will
increment. The two items are often used together, but they don't have to
be. For example, a primary key could be the two-letter abbreviation for all
the US states, there's no need for the records to have an identity row if
they already have a unique value.
Ah! Yes, that makes sense. Thanks for the explanation.
Do you have any data in the table that you are trying to create the
identity row on? It could be that you already have null values in the
field you are trying to change.
I did, but none of it was null. I then deleted all the data so it was an
empty table, and I still couldn't set the field to be an identity.

I then created a new table. I STILL can't set a field to be the Identity.
(Identity Specification = Yes). I'm stumped. It's set to INT data type allow
NULLS is NOT checked.

-Darrel
Jan 30 '07 #5
I then created a new table. I STILL can't set a field to be the Identity.
(Identity Specification = Yes). I'm stumped. It's set to INT data type
allow NULLS is NOT checked.
Ugh. I'm an idiot.

You have to EXPAND the 'Identity Specification' item in the properties pane
and then change the IS IDENTITY property there.

'doh!

-Darrel
Jan 30 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
2839
by: Gerry Abbott | last post by:
Hi all, I having some confusing effects with recordsets in a recent project. I created several recordsets, each set with the same number of records, and related with an index value. I create...
7
2112
by: davegb | last post by:
I'm totally new to relational database design. My boss has asked me to create a database of information on the employees in our group. Seemed to me like a simple application to learn the ropes. A...
18
18302
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on...
5
1900
by: naveenpuskur | last post by:
Hi Guys, New to DB2 . Want to create a disaster DB2 server with minimum resources, as client(small company) can't afford big and don't have much budget to spend.Currently backing to local...
4
2512
by: Andrew Robinson | last post by:
My main dev machine has WinXp and VS2005 (pro). 1. I need to install VWD Express Edition so that I can do some instruction on this. Any issues with both on the same machine. Installation order?...
3
1318
by: msnews.microsoft.com | last post by:
Hello Can any one tell me that if I buy Microsoft Visual Studio 2005 Professional for dotnet, do I get following product Visual Basic Express Visual C# Express Sql Server Express Web...
9
5742
by: HC | last post by:
Hello, all, I started out thinking my problems were elsewhere but as I have worked through this I have isolated my problem, currently, as a difference between MSDE and SQL Express 2005 (I'll just...
4
7076
by: Amber | last post by:
The installer tells it faild to config db2inst1, the db2setup.err is as following: /usr/share/themes/Clearlooks/gtk-2.0/gtkrc:60: Engine "clearlooks" is unsupporte d, ignoring Jun 15, 2007...
11
2014
by: kimiraikkonen | last post by:
Hello, I'm very new to C# and just installed VC# 2005 express edition and i have VB 2005 express installed previously. But i saw a thing which may be called as a "Visual C# 2005 express" bug? ...
0
7203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.