mssql-script



Microsoft SQL Server is a relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applications—which may run either on the same computer or on another computer across a network.

Attendance working days

UPDATE Student SET WorkDay = ‘137’ WHERE Standard = ‘6th’;
UPDATE Student SET WorkDay = ‘137’ WHERE Standard = ‘7th’;
UPDATE Student SET WorkDay = ‘137’ WHERE Standard = ‘8th’;
UPDATE Student SET WorkDay = ‘137’ WHERE Standard = ‘9th’;
UPDATE Student SET WorkDay = ‘123’ WHERE Standard = ’10th’;

DELETE REPORT CARD OR EXAM RESULT

DELETE FROM StudentExamResult WHERE ExamId = 31 ;

DELETE FROM ReportCard WHERE ExamId = 31;

TOTAL GRADE – BASED ON PERCENTAGE

UPDATE ReportCard SET Grade = ‘A+’ WHERE Percentage >= ’90’;

UPDATE ReportCard SET Grade = ‘A’ WHERE Percentage >= ’80’ and Percentage < '90';

UPDATE ReportCard SET Grade = ‘B+’ WHERE Percentage >= ’70’ and Percentage < '80';

UPDATE ReportCard SET Grade = ‘B’ WHERE Percentage >= ’60’ and Percentage < '70';

UPDATE ReportCard SET Grade = ‘C’ WHERE Percentage >= ’50’ and Percentage < '60';

GRADE OF SUBJECTS BASED ON MARKS OBTAINED

UPDATE StudentExamResult SET Grade = ‘A+’ WHERE MarksObtained >= ’45’;

UPDATE StudentExamResult SET Grade = ‘A’ WHERE MarksObtained >= ’40’ and MarksObtained < '45';

UPDATE StudentExamResult SET Grade = ‘B+’ WHERE MarksObtained >= ’35’ and MarksObtained < '40';

UPDATE StudentExamResult SET Grade = ‘B’ WHERE MarksObtained >= ’30’ and MarksObtained < '35';

UPDATE StudentExamResult SET Grade = ‘C’ WHERE MarksObtained >= ’25’ and MarksObtained < '30';

STANDARD CHANGE NEXT YEAR

DELETE FROM Student where Standard=’10th’
update Student set Standard = ’10th’ where Standard = ‘9th’
update Student set Standard = ‘9th’ where Standard = ‘8th’
update Student set Standard = ‘8th’ where Standard = ‘7th’
update Student set Standard = ‘7th’ where Standard = ‘6th’
update Student set Standard = ‘6th’ where Standard = ‘5th’
update Student set Standard = ‘5th’ where Standard = ‘4th’
update Student set Standard = ‘4th’ where Standard = ‘3rd’
update Student set Standard = ‘3rd’ where Standard = ‘2nd’
update Student set Standard = ‘2nd’ where Standard = ‘1st’
update Student set Standard = ‘1st’ where Standard = ‘SN’
update Student set Standard = ‘SN’ where Standard = ‘JN’
update Student set Standard = ‘JN’ where Standard = ‘PN’

delete receipt

./Payment/DeletePayment/xxx
Replace xxx with receipt no

DELETE FROM StudentPayment WHERE ReceiptNum = XXX ;

DELETE FROM StudentPayment WHERE StudentName = XXX ;