I am working on a SQL Server database in which there are no primary
keys set on the tables. I can tell what they are using for a key. It
is usually named ID, has a data type of int and does not allow nulls.
However, since it is not set as a primary key you can create a
duplicate key.
This whole thing was created by someone who is long gone. I don't
know how long I will be here and I don't want to break anything. I
just want to work with things the way they are.
So if I want to insert a new record, and I want the key, which is
named ID, to be the next number in the sequence, is there something I
can do in an insert sql statement to do this?Often, the quality of the responses received is related to our ability to
'bounce' ideas off of each other. In the future, to prevent folks from
wasting time on already answered questions, please:
Don't post to multiple newsgroups. Choose the one that best fits your
question and post there. Only post to another newsgroup if you get no answer
in a day or two (or if you accidentally posted to the wrong newsgroup), and
indicate that you've already posted elsewhere.
If you really think that a question belongs into more than one newsgroup,
then use your newsreader's capability of multi-posting, i.e., posting one
occurrence of a message into several newsgroups at once. If you multi-post
appropriately, answers 'should' appear in all the newsgroups. Folks
responding in different newsgroups will see responses from each other, even
if the responses were posted in a different newsgroup.
See .programming
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"tom c" <tomcarr1@.gmail.com> wrote in message
news:1157578232.173886.295680@.m79g2000cwm.googlegroups.com...
>I am working on a SQL Server database in which there are no primary
> keys set on the tables. I can tell what they are using for a key. It
> is usually named ID, has a data type of int and does not allow nulls.
> However, since it is not set as a primary key you can create a
> duplicate key.
> This whole thing was created by someone who is long gone. I don't
> know how long I will be here and I don't want to break anything. I
> just want to work with things the way they are.
> So if I want to insert a new record, and I want the key, which is
> named ID, to be the next number in the sequence, is there something I
> can do in an insert sql statement to do this?
>|||Will do Arnie. Sorry for the double post. I found .programming after I
had already posted here and then realized it was a better place for the
question and re posted it there. I won't do it again. Thanks for you
help.
Arnie Rowland wrote:
> Often, the quality of the responses received is related to our ability to
> 'bounce' ideas off of each other. In the future, to prevent folks from
> wasting time on already answered questions, please:
> Don't post to multiple newsgroups. Choose the one that best fits your
> question and post there. Only post to another newsgroup if you get no answer
> in a day or two (or if you accidentally posted to the wrong newsgroup), and
> indicate that you've already posted elsewhere.
> If you really think that a question belongs into more than one newsgroup,
> then use your newsreader's capability of multi-posting, i.e., posting one
> occurrence of a message into several newsgroups at once. If you multi-post
> appropriately, answers 'should' appear in all the newsgroups. Folks
> responding in different newsgroups will see responses from each other, even
> if the responses were posted in a different newsgroup.
>
> See .programming
>
> --
> Arnie Rowland, Ph.D.
> Westwood Consulting, Inc
> Most good judgment comes from experience.
> Most experience comes from bad judgment.
> - Anonymous
>
> "tom c" <tomcarr1@.gmail.com> wrote in message
> news:1157578232.173886.295680@.m79g2000cwm.googlegroups.com...
> >I am working on a SQL Server database in which there are no primary
> > keys set on the tables. I can tell what they are using for a key. It
> > is usually named ID, has a data type of int and does not allow nulls.
> > However, since it is not set as a primary key you can create a
> > duplicate key.
> >
> > This whole thing was created by someone who is long gone. I don't
> > know how long I will be here and I don't want to break anything. I
> > just want to work with things the way they are.
> >
> > So if I want to insert a new record, and I want the key, which is
> > named ID, to be the next number in the sequence, is there something I
> > can do in an insert sql statement to do this?
> >
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment