86
insert into Passport(Series, Number, GiveBy, DateOfGet)
values(@Series, @Number, @GiveBy, @DateOfGet)
declare @PassportID int
set @PassportID = @@identity
insert into EducationDoc(EducationDocTypeID,IsCopy, IsExcellence, Series, Number, SchoolName,
GradeYear)
values(@EducationDocTypeID,@IsCopy, @IsExcellence, @SeriesDoc, @NumberDoc, @SchoolName,
@GradeYear)
declare @EducationDocID int
set @EducationDocID = @@identity
insert into Entrant
(ApplicationStatusID,SpecialityID,PassportID,CitizenshipID,EducationDocID,
MilitaryStatusID,EnterPlaceID,LearnFormID,LanguageID,FamilyStatusID,
RegistrationAddressID,LastName,FirstName,SecondName,
BirthDate,Sex,NeedHostel,EnterTime,MilitaryRegistration,ApplicationDate,
PersonalFileNumber,ExamListNumber,Phone,BornPlace,
FatherID,MotherID, IsPrepared, FileIsGive, GiveFileDate)
values (@ApplicationStatusID,@SpecialityID,@PassportID,
@CitizenshipID,@EducationDocID,@MilitaryStatusID,@EnterPlaceID,
@LearnFormID,@LanguageID,@FamilyStatusID,@AddressID,
@LastName,@FirstName,@SecondName,@BirthDate,@Sex,
@NeedHostel,@EnterTime,@MilitaryRegistration,
@ApplicationDate,@PersonalFileNumber,@ExamListNumber,
@Phone,@BornPlace,-1,-1,@IsPrepared, @FileIsGive, @GiveFileDate)
declare @EntrantID int
set @EntrantID = @@identity
return @EntrantID
Из приведенного листинга видно, что использование хранимых
процедур позволяет значительно уменьшить объем исходного кода клиентского
приложения. И тем самым сделать его намного менее зависимым от физической
структуры базы данных.
В клиентском приложении системы автоматизации «Росинфом»
выполнение запросов к базе данных выполняется исключительно через