Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Identity

Author  Topic 

kprasadreddy
Starting Member

41 Posts

Posted - 2007-02-20 : 13:20:47
I have a user table where user number is the primary key(integer).I do not want to implement it as an indetity but want a one up number.What are my options?

Thanks

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-02-20 : 13:40:01
Since you don't want to use an identity, you should start by explaining why that is not a good option.



CODO ERGO SUM
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-02-20 : 13:45:11
The key part is here: I do not want to
You are asking for something that increments your (int) PK by one. This is exactly what an identity does. Why would you not want to use it?

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-02-20 : 13:54:21
Or, you can look at this...

http://weblogs.sqlteam.com/brettk/archive/2004/06/29/1687.aspx

That is the "old" way we used to have to do this before IDENTITY came along

But why would you want to do this?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2007-02-20 : 15:31:40
Because he (or his boss) has been told that Identity values are the stuff of the Devil? Perhaps he works for the same company as Derek Asirvadem:
http://www.dbforums.com/showthread.php?t=1611990


STAR SCHEMAS ARE NOT DATA WAREHOUSES!
Go to Top of Page
   

- Advertisement -