1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| ALTER procedure ps_i_CopyProfilDefault
@Id_Interv integer
AS
declare @Id_Prof varchar(4000)
declare @id_profil_identity integer
set @Id_Prof = (select Id_Profil from Profil Where Id_Intervenant=@Id_Interv and IsDefault=1)
print @Id_Prof
if @Id_Prof !=NULL
Begin Tran
INSERT INTO Profil(Id_Intervenant,Description,Naissance,Debut_experience,Id_Societe,Id_Titre_Professionnel,Commentaire,IsDefault,Z_User,Z_Created,Z_Modified)
SELECT Id_Intervenant,Description,Naissance,Debut_experience,Id_Societe,Id_Titre_Professionnel,Commentaire,0,Z_User,Z_Created,Z_Modified
FROM Profil P Where Id_Profil=@Id_Prof
set @id_profil_identity = @@identity
INSERT INTO Connaissance(Id_Profil,Id_Intervenant,Id_Domaine,Id_Item,Commentaire,Z_User,Z_Created,Z_Modified)
Select @id_profil_identity,Id_Intervenant,Id_Domaine,Id_Item,Commentaire,Z_User,Z_Created,Z_Modified from Connaissance Where Id_Profil=@Id_Prof
INSERT Into Formation_Complementaire(Id_Profil,Id_Intervenant,Id_Annee,Id_Outil,Commentaire,Z_User,Z_Created,Z_Modified)
Select @id_profil_identity,Id_Intervenant,Id_Annee,Id_Outil,Commentaire,Z_User,Z_Created,Z_Modified from Formation_Complementaire Where Id_Profil=@Id_Prof
Insert into Formation (Id_Profil,Id_Intervenant,Id_Annee,Id_Diplome,Commentaire,Z_user,Z_Created,Z_Modified)
Select @id_profil_identity,Id_Intervenant,Id_Annee,Id_Diplome,Commentaire,Z_user,Z_Created,Z_Modified from Formation Where Id_Profil=@Id_Prof
Insert into Experience(Id_Profil,Id_Intervenant,Id_MoisDebut,Id_AnneeDebut,Id_MoisFin,Id_AnneeFin,Id_Titre_Professionnel,Id_Client,Commentaire,Z_User,Z_Created,Z_Modified)
Select @id_profil_identity,Id_Intervenant,Id_MoisDebut,Id_AnneeDebut,Id_MoisFin,Id_AnneeFin,Id_Titre_Professionnel,Id_Client,Commentaire,Z_User,Z_Created,Z_Modified from Experience Where Id_Profil=@Id_Prof
commit tran |
Partager