Unix Technical Forum

primary key autoincrement question.

This is a discussion on primary key autoincrement question. within the SQL Server forums, part of the Microsoft SQL Server category; --> I have a table in my sqlserver 2000 that has a field IDNO. i want this field to be ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 02:22 AM
jaYPee
 
Posts: n/a
Default primary key autoincrement question.

I have a table in my sqlserver 2000 that has a field IDNO. i want this
field to be my primary key. however i don't want this field to use the
autoincrement feature. when i access this table from vb.net and try to
add a record this field is autoincrementing. how can i disable the
autoincrement of this field yet serves this as my primary key?

thanks in advance
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 02:22 AM
EricJ
 
Posts: n/a
Default Re: primary key autoincrement question.

go to design, select your id make shure that there is a key symbol next to
it (if not right click and set primary key)
this makes it the primary key the identity is something else -->
autoincrementing set it to false and there you go

hope it helps

eric

"jaYPee" <hijaypee@yahoo.com> wrote in message
news:8vl470phkea0fueivehemm3h882ousjg8f@4ax.com...
> I have a table in my sqlserver 2000 that has a field IDNO. i want this
> field to be my primary key. however i don't want this field to use the
> autoincrement feature. when i access this table from vb.net and try to
> add a record this field is autoincrementing. how can i disable the
> autoincrement of this field yet serves this as my primary key?
>
> thanks in advance



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 02:22 AM
jaYPee
 
Posts: n/a
Default Re: primary key autoincrement question.

Thank you for the reply. however i can't find an autoincrementing
properties under column properties in order to set it to false.

under column properties of IDNO field i have i only see this
properties:

Description
Default Value
Precision
Scale
Identity
Identity Seed
Identity Increment
Is RowGuid
Formula
Collation

i presume before and until now that i have to set the identity to "no"
but still in my vb.net app when i add record the IDNO field still
increment to the last value + 1.

don't know where can i set the autoincrement to "false"

thanks again

On Tue, 6 Apr 2004 09:41:21 +0200, "EricJ"
<ericReMoVe@ThiSbitconsult.be.RE> wrote:

>go to design, select your id make shure that there is a key symbol next to
>it (if not right click and set primary key)
>this makes it the primary key the identity is something else -->
>autoincrementing set it to false and there you go
>
>hope it helps
>
>eric
>
>"jaYPee" <hijaypee@yahoo.com> wrote in message
>news:8vl470phkea0fueivehemm3h882ousjg8f@4ax.com.. .
>> I have a table in my sqlserver 2000 that has a field IDNO. i want this
>> field to be my primary key. however i don't want this field to use the
>> autoincrement feature. when i access this table from vb.net and try to
>> add a record this field is autoincrementing. how can i disable the
>> autoincrement of this field yet serves this as my primary key?
>>
>> thanks in advance

>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-29-2008, 02:22 AM
EricJ
 
Posts: n/a
Default Re: primary key autoincrement question.

these are the ones you are after

> Identity
> Identity Seed
> Identity Increment


yust set the identity to false the rest will follow

eric

"jaYPee" <hijaypee@yahoo.com> wrote in message
news:aos470d3p2gup57707rmeib2907453sn69@4ax.com...
> Thank you for the reply. however i can't find an autoincrementing
> properties under column properties in order to set it to false.
>
> under column properties of IDNO field i have i only see this
> properties:
>
> Description
> Default Value
> Precision
> Scale
> Identity
> Identity Seed
> Identity Increment
> Is RowGuid
> Formula
> Collation
>
> i presume before and until now that i have to set the identity to "no"
> but still in my vb.net app when i add record the IDNO field still
> increment to the last value + 1.
>
> don't know where can i set the autoincrement to "false"
>
> thanks again
>
> On Tue, 6 Apr 2004 09:41:21 +0200, "EricJ"
> <ericReMoVe@ThiSbitconsult.be.RE> wrote:
>
> >go to design, select your id make shure that there is a key symbol next

to
> >it (if not right click and set primary key)
> >this makes it the primary key the identity is something else -->
> >autoincrementing set it to false and there you go
> >
> >hope it helps
> >
> >eric
> >
> >"jaYPee" <hijaypee@yahoo.com> wrote in message
> >news:8vl470phkea0fueivehemm3h882ousjg8f@4ax.com.. .
> >> I have a table in my sqlserver 2000 that has a field IDNO. i want this
> >> field to be my primary key. however i don't want this field to use the
> >> autoincrement feature. when i access this table from vb.net and try to
> >> add a record this field is autoincrementing. how can i disable the
> >> autoincrement of this field yet serves this as my primary key?
> >>
> >> thanks in advance

> >

>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-29-2008, 02:23 AM
--CELKO--
 
Posts: n/a
Default Re: primary key autoincrement question.

>> I have a table in my SQL Server 2000 that has a field [sic] IDNO. I
want this field [sic] to be my primary key. <<

You need to read a book on SQL and RDBMS. Rows are not records; fields
are not columns; tables are not files; there is no sequential access
or ordering in an RDBMS, so "first", "next" and "last" are totally
meaningless.

What does this table model in the real world? Look at the real world
and ask what the key is. It cannot ever be the internal state of the
hardware in which your model resides. You are still thinking that
there are rcord numbers, like a sequential file system in an RDBMS --
you even use the terminology of a sequential file system.

This is totally wrong. There is no "Magic, Universal
one-size-fits-all" way to get a key. Building a data model is work.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:59 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com