Yes, it's possible. Exactly how you would do it will depend on what kind of systems you are interfacing, and where you are storing the info, and where you want to generate it.
However, I would suggest that you re-think your scheme a little: firstly work out how many students you can get in a year and allocate a suitable number of digits as a fixed length. So if you can expect 250 students in a year, allow three digits and pad with zeros, if you can expect 950 than allow four digits and again pad with zeros.
Secondly, change the order slightly: swap the year and student number.
ssYYYYnnnn
where
ss is the school,
YYYY is the year,
nnnn is the student number
Is a lot easier to search for and sort than dealing with variable length student numbers in the middle.
"sir i am coding through front end that means through asp.net...."
I see from you modifications to the question that you are using SQL - OK, here is how I would do it.
SQL Server has the facility to generate automatic number fields: it can add a value (one for example) to an integer field each time you insert a record. If you use this, you can preset it to the year and a start number each academic year:
20120001 for the year 2012-2013
20130001 for the year 2013-2014
20140001 for the year 2014-2015
And it will generate the number for you.
If you set up two fields in your table:
SchoolId CHAR(2)
StudentID INT, Identity
You can return the whole code by:
SELECT SchoolId + CAST(StudentId AS varChar(8)) AS ID FROM myTable
At the start of registrations for the new academic year, you reset the starting value of the identity field to the new year value, and let SQL handle all the rest! The beauty of this is that it lets SQL do the work, so this will always work in a multiuser environment - so if you have five clerks entering new student data, they can't end up with two students with the same number!