Click to See Complete Forum and Search --> : SQL Server Primary Key question


lmf232s
03-29-2005, 06:50 PM
I was wondering if there is a way with in SQL Server to have a primary key that is formated instead of a auto number.

I would like a format of something like this

ND1047
ND1048
ND1049

This would be alittle better to work with as i could name the files that are uploaded with a more meaningful name than just a new number.

phpnovice
03-29-2005, 07:17 PM
You mean an autoincrementing number with that character prefix for a format? No. Otherwsie, yes, you can define a primary key that is not an autoincrement column. After that, it is up to you to format the key and insure that it is unique -- possibly using a 2-column primary key.