metalpain Posted October 6, 2008 Share Posted October 6, 2008 Hello, I am trying to create a unique primary key that has alpha and numeric values that auto generate, so far i can get the numbers to auto generate but i have no idea how to add alpha characters to it. basic what i want to do is add for example two alpha characters SF in front of the auto incremented numbers so for example SF100000 then SF100001 and so on. is it possible to do this? below is a copy of my script. thankyou. -- Create Staff Table -- CREATE TABLE Staff( Staff# BIGINT IDENTITY(100000,1) not null, Staff_name varchar(25)not null, Staff_surname varchar(25)not null, Staff_phone varchar(10), Staff_Address varchar(50), Staff_postcode numeric (4), Staff_Salary numeric (8,2), Staff_Postion varchar (30), constraint STAFF_PK PRIMARY KEY (staff#) ); Quote Link to comment https://forums.phpfreaks.com/topic/127190-unique-primary-key-with-alpha-and-numeric/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.