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
 General SQL Server Forums
 New to SQL Server Programming
 Automatically generating values for PK

Author  Topic 

ericaq_74
Starting Member

2 Posts

Posted - 2007-08-08 : 15:39:59
Hi,

I am new to SQl Server, i have created a logical model for a database that i am creating for a project. Is there a way i can assign automatic values to my Primary Key (PK) Column other than using an identity?

For example i have a table called indicator for which the Primary Key (PK) is indicator_identifier; i want the primary key values to be
ind_0001
ind_0002
ind_0003

Please note that i may be populating the tables from a VB.NET form

Please can anybody help me?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-08 : 16:05:44
http://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-08-08 : 17:11:48
quote:
Originally posted by ericaq_74

Hi,

I am new to SQl Server, i have created a logical model for a database that i am creating for a project. Is there a way i can assign automatic values to my Primary Key (PK) Column other than using an identity?

For example i have a table called indicator for which the Primary Key (PK) is indicator_identifier; i want the primary key values to be
ind_0001
ind_0002
ind_0003

Please note that i may be populating the tables from a VB.NET form

Please can anybody help me?



This is almost always a really bad idea. Just use an identity column to create sequential numbers.





CODO ERGO SUM
Go to Top of Page
   

- Advertisement -