Login    Forum    Search    FAQ   Blog

Board index » Server Side Development » SQL




 Page 1 of 1 [ 8 posts ] 



Author Message
 Post subject: Sql Unique Id r No. generator.
 Post Posted: Sat Nov 21, 2009 2:03 pm 
Offline

Joined: Sat Feb 21, 2009 11:41 am
Posts: 45
Hey,,,, could neone help me in dis !!!
i need to store procedure wid generates a Unique No. or id wen a new row was
inserted in it by da asp.net form..
dont like 2 use tda Identity method...


Top 
 Post subject: Re: Sql Unique Id r No. generator.
 Post Posted: Sat Nov 21, 2009 2:03 pm 
Offline

Joined: Sat Feb 21, 2009 11:06 am
Posts: 1794
use newid()


Top 
 Post subject: Re: Sql Unique Id r No. generator.
 Post Posted: Sat Nov 21, 2009 2:03 pm 
Offline

Joined: Sat Feb 21, 2009 1:08 pm
Posts: 549
what was wrong wid the identity?


Top 
 Post subject: Re: Sql Unique Id r No. generator.
 Post Posted: Sat Nov 21, 2009 2:03 pm 
Offline

Joined: Sat Feb 21, 2009 11:06 am
Posts: 1794
I would definitely use IDENTITY 4 dat ; it seems 2 me so simpler
nd efficient - is not it?

Code:
CREATE TABLE [MyTable] (
[id] [bigint] IDENTITY (1, 1) NOT NULL ,
[F1] [varchar] (400) COLLATE Latin1_General_CS_AS NULL
)


Top 
 Post subject: Re: Sql Unique Id r No. generator.
 Post Posted: Sat Nov 21, 2009 2:03 pm 
Offline

Joined: Sat Feb 21, 2009 1:08 pm
Posts: 549
..


Top 
 Post subject: Re: Sql Unique Id r No. generator.
 Post Posted: Sat Nov 21, 2009 2:04 pm 
Offline

Joined: Sat Feb 21, 2009 11:41 am
Posts: 45
Hi thanks 2 all of u Guys....
If all f ma purposes solve wid da help of the identity than i definitely
use it But as u know all as if i removed a record 4m dat t table,,,than
If i use Identity than it never assigns that coloumn value again,,,
so i to et devoid of that thing,,,,,,,
i need all da records in a sequence ,,,,,so tell me another method or store procedure to do this,,,,,
thanks in adv,


Top 
 Post subject: Re: Sql Unique Id r No. generator.
 Post Posted: Sat Nov 21, 2009 2:04 pm 
Offline

Joined: Sat Feb 21, 2009 1:08 pm
Posts: 549
No matter what method u use 2 assign a unique number,
you would still have a gap in da seq if you delete a row.

Any method besides identity that you use will be more resource intensive and limit the scalability of your applicaiton.


Top 
 Post subject: Re: Sql Unique Id r No. generator.
 Post Posted: Sat Nov 21, 2009 2:04 pm 
Offline

Joined: Sat Feb 21, 2009 11:41 am
Posts: 45
But you shouldnt really be worryin abt missin no's in between.
You cold still retrieve da existin the records dependin on the order of identity column.


Top 
Display posts from previous:  Sort by  
 
 Page 1 of 1 [ 8 posts ] 




Board index » Server Side Development » SQL


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron