May be you have to maintain the Registration numbers in another table say....
CREATE TABLE [dbo].[Registration]( [Year] [int] NOT NULL, [RegistrationNumber] [int] NOT NULL ) Based on the year, you have to autoincrement RegistrationNumber. While inserting Student_Details generate the Student_ID from RegistrationNumber Hope that helps ! On Tue, Nov 17, 2009 at 4:06 PM, nu1silva <[email protected]> wrote: > hi all, > > im developing a Student Management software and im just going through > the registration of a student. > > i need to assign the registration number --> T(year)-(# of > registration for the year) so it'll be like > T09-001 or T09-089 or T09-243 an so on.... > > i get the input of the year and can count the number from the > database. > > how can i get the registration number? > > the sample o the Student Database... > > CREATE TABLE Student_Details > ( > Student_ID varchar(10) NOT NULL UNIQUE, -- example ( > T09-001 ) > Fname varchar(255), > Lname varchar(255), > Full_Name varchar(255), > -- > Address varchar(255), > DOB datetime, > ContactNO varchar(15), > email varchar(25), > additional_detail varchar(255), > Course_ID varchar(10), > Dateof_Admission datetime, > --Dateof_Graduation datetime, > PRIMARY KEY(Student_ID) > ) > > > help!!! :( >
