Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Identity col
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ss  
View profile  
 More options Feb 20 2004, 5:35 pm
Newsgroups: sybase.public.ase.general
From: "ss" <sandeep_shan...@yahoo.com>
Date: 20 Feb 2004 14:34:49 -0800
Local: Fri, Feb 20 2004 5:34 pm
Subject: Identity col
I would like to add Indetntiy property to exitinng column which has unique
data
and would like to start it from 100. Could anybody please
give me the syntax

TIA
.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bret Halford  
View profile  
 More options Feb 20 2004, 5:44 pm
Newsgroups: sybase.public.ase.general
From: Bret Halford <b...@sybase.com>
Date: 20 Feb 2004 14:43:38 -0800
Local: Fri, Feb 20 2004 5:43 pm
Subject: Re: Identity col

ss wrote:

> I would like to add Indetntiy property to exitinng column which has unique
> data
> and would like to start it from 100. Could anybody please
> give me the syntax

> TIA
> .

I believe the supported way would be to bcp the data out,
drop the table and recreate it with that column having
identity, bcp in using -E.

Following that, newly generated identity values will start
with 1 larger than the largest value bcped in.  If you want
to set it to a higher value, use the "set identity_insert <table> on"
option and insert a dummy row with a higher value, then turn the
option off and delete the dummy row.  Future inserts will
increment from that value.

-bret


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ss  
View profile  
 More options Feb 20 2004, 8:03 pm
Newsgroups: sybase.public.ase.general
From: "ss" <sandeep_shan...@yahoo.com>
Date: 20 Feb 2004 15:52:40 -0800
Local: Fri, Feb 20 2004 6:52 pm
Subject: Re: Identity col
Can we run bcp in sql analyzer

"Bret Halford" <b...@sybase.com> wrote in message

news:40368D93.3A2342A2@sybase.com...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jus  
View profile  
 More options Feb 21 2004, 2:38 am
Newsgroups: sybase.public.ase.general
From: "Jus" <jus.c...@ntlworld.com>
Date: 20 Feb 2004 23:38:09 -0800
Local: Sat, Feb 21 2004 2:38 am
Subject: Re: Identity col
"ss" <sandeep_shan...@yahoo.com> wrote in message

news:40369dc8$1@forums-1-dub...

> Can we run bcp in sql analyzer

No, it's a command line tool.

Justin.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rob Verschoor  
View profile  
 More options Feb 21 2004, 8:03 am
Newsgroups: sybase.public.ase.general
From: "Rob Verschoor" <r...@DO.NOT.SPAM.sypron.nl.REMOVE.THIS.DECOY>
Date: 21 Feb 2004 03:48:24 -0800
Local: Sat, Feb 21 2004 6:48 am
Subject: Re: Identity col
"ss" <sandeep_shan...@yahoo.com> wrote in message

news:40368b88$1@forums-2-dub...

> I would like to add Indetntiy property to exitinng column which has
unique
> data
> and would like to start it from 100. Could anybody please
> give me the syntax

> TIA

Let's assume your current table is as follows: create table t (a int,
b int)

Then run these statements:

create table t2 (n numeric(6) identity, a int, b int)  -- change '6'
(the number of digits) as needed...

set identity_insert t2 on
insert t2 (n, a, b) values (99, 0, 0)
set identity_insert t2 off
delete t2

insert t2 (a,b)
select a,b from t
order by a   --  'order by' is needed only when you want a certain
ordering in the current rows; this can be omitted

And finally:

drop table t
go
sp_rename t2, t
go

I think this does what you want. Keep in mind that the insert...select
may take a long time if the table is big. Alternatively, you can use
bcp to copy the table (use -E during the bcp-in).

HTH,

Rob
-------------------------------------------------------------
Rob Verschoor

Certified Sybase Professional DBA for ASE 12.5/12.0/11.5/11.0
and Replication Server 12.5

Author of "Tips, Tricks & Recipes for Sybase ASE" and
"The Complete Sybase ASE Quick Reference Guide"
Online orders accepted at http://www.sypron.nl/shop

mailto:r...@YOUR.SPAM.sypron.nl.NOT.FOR.ME
http://www.sypron.nl
Sypron B.V., P.O.Box 10695, 2501HR Den Haag, The Netherlands
-------------------------------------------------------------


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »