Click here to Skip to main content
15,880,651 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hai Sir,

How to generate auto generated Student Id based on Branch and Course likewise two Modules for College Registration..??
Posted
Comments
OriginalGriff 19-May-15 2:36am    
We'd need to know a little more about what the final Id should look like: Remember that we can't see your screen, access your HDD, or read your mind.
And there are a lot of different information types here - we have no idea what exactly you need.
Use the "Improve question" widget to edit your question and provide better information.
Vinay Haravi 19-May-15 3:06am    
Whether you wanted to generate Registration ID or Student ID ?
Provide more information on this, so that we can help you to resolve this issue.
Hemant Singh Rautela 19-May-15 4:00am    
There are many ways :
1) just use auto generated column(int) for it.
2) create a code for update student-id column (first 2 digit for year, then 2/3 digit for branch code , 2/3 digit for course code - and last use 3 digit number for uniquely define student).
ZurdoDev 19-May-15 8:12am    
Where are you stuck?

1 solution

refer

declare @Count int
declare @id varchar(10)

SET @Count = 1
WHILE (@Count <=10)
BEGIN
set @id='C'+RIGHT(REPLICATE('0', 4) + CAST(@Count AS VARCHAR(4)), 4)
PRINT @id
SET @Count = @Count + 1
END
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900