IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MS SQL Server Discussion :

procedure update insert


Sujet :

MS SQL Server

  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    61
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 61
    Points : 32
    Points
    32
    Par défaut procedure update insert
    bonjour à tous, j'aurais voulu savoir si dans une procédure stockée avec curseur il existait un moyen quelconque de savoir si un champ à été inséré ou modifier dans la table référencé par le curseur!
    Je sais que c'est possible avec les triggers mais qu'en est il pour les procédures stockées?

  2. #2
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    61
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 61
    Points : 32
    Points
    32
    Par défaut
    Personne n'a une idée???

    Je cherche toujours mais pour le moment sans résultat...

  3. #3
    Membre éprouvé
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Août 2006
    Messages
    730
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2006
    Messages : 730
    Points : 923
    Points
    923
    Par défaut
    réponse non.

    si c'est toujours ton pb avec client avec adresse...

    pour ma part (c'est peut être pas le mieux ) je créerai une table du type

    create table log_upd
    (pk_id int int identity(1,1),
    nom_table varchar(50),
    id_table int, -- correspond a la valeur de la pk de la table nom_table
    date_ins datetime,
    date_upd datetime,
    flag_maj smallint not null default 0
    )
    puis un trigger sur les tables que tu veux surveiller

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    create trigger ... on ..
    for insert
    begin
    insert into log_upd (nom_table,id_table,date_ins) ('nom_table',valeur_index,getdate())
    end
     
    create trigger ... on ..
    for update
    begin
    insert into log_upd (nom_table,id_table,date_upd) ('nom_table',valeur_index,getdate())
    end
    ou valeur index est le select de ta pk from inserted

    et ensuite je ferai une jointure avec log_upd where nom_table=.. and flag_maj =0

    la maj faite, je passe le flag a 1

    j'ai utilisé ce système pour valider les annonces d'un site

  4. #4
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    61
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 61
    Points : 32
    Points
    32
    Par défaut
    non ce n'est plus le meme probleme!
    Pour la table adresse j'ai résolu le pb plus simplement en choisissant comme pivot de jointure un champs qui doit obligatoirment etre renseigné mais qui ne peut pas etre modifié...

    Mais le truc auquel je n'avais pas penser c'était de différencier update et insert.
    Pour savoir si un update est nécessaire jutilise en effet un champs CBModification créér dans ma table F_comptet(dans laquele les nouveaus champs sont créés). Si ce champs a pour valeur la date du jour c'est qu'il à été modifier donc à ce moment la j'update dans mon autre table AccountBase.
    Jusque la tous marche bien.

    Par contre je viens de me rendre compte que le champs CBmodification est aussi mise à jour lors de l'insertion d'un nouveau client dans F_cOMPTET. du coup si je me base sur ce champs seulement je ne sais pas si il faut mettre a jour ou bien inserer???

    Il me faut donc trouver un moyen...

    Le probleme c'est qu'il ne me reste plus que jusqu'a la fin de la semaine pour terminer mon application...

  5. #5
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    61
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 61
    Points : 32
    Points
    32
    Par défaut
    La je cherche du coté des variable systeme du genre @@rowcount et @@identity...

    J'ai peut etre trouvé mon bohneur


    J'ai fait ca:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    31
    32
    33
    34
    35
     
     
    Update AMIELEC_MSCRM.dbo.AccountBase
    SET AccountCategoryCode=@catcomptaInt,TerritoryId=@conv_pays,DefaultPriceLevelId=@id_tarif,
    OwningUser=@id_utilisateur,AccountNumber=@numpayeur,Description=@intitule,WebSiteURL=@site,EMailAddress1=@mail,
    Telephone1=@telephone,Fax=@fax,ParentAccountId=@idnom_parent,StatusCode=1,StateCode=0,DeletionStateCode=0
    where Name=@Num 
    Print('maj du client'+@num)
     
    if @@rowcount=0
    BEGIN
    --INSERTION DANS LES TABLES DE LA CRM
    insert into AMIELEC_MSCRM.dbo.AccountBase(AccountId,OwningBusinessUnit,AccountCategoryCode,TerritoryId,DefaultPriceLevelId,
    CustomerSizeCode,PreferredContactMethodCode,PreferredAppointmentDayCode,PreferredAppointmentTimeCode,CustomerTypeCode,AccountRatingCode,IndustryCode,TerritoryCode,
    AccountClassificationCode,BusinessTypeCode,OwningUser,OriginatingLeadId,PrimaryContactId,Name,AccountNumber,Revenue,NumberOfEmployees,Description,SIC,OwnershipCode,MarketCap,
    SharesOutstanding,TickerSymbol,StockExchange,WebSiteURL,FtpSiteURL,EMailAddress1,EMailAddress2,EMailAddress3,Telephone1,DoNotPhone,DoNotFax,DoNotEMail,DoNotSendMM,DoNotPostalMail,DoNotBulkEMail,DoNotBulkPostalMail,
    Telephone2,Fax,Telephone3,CreditLimit,CreditOnHold,ParentAccountId,StatusCode,StateCode,DeletionStateCode)
    values(NEWID(),@businness_unit,@catcomptaInt,@conv_pays,@id_tarif,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,@id_utilisateur,
    Null,Null,@num,@numpayeur,Null,Null,@intitule,Null,Null,Null,Null,Null,Null,@site,Null,@mail,Null,Null,@telephone,0,0,0,0,0,0,Null,Null,@fax,Null,Null,Null,@idnom_parent,1,0,0)
    Print('insert du client'+@num)
    print(@@IDENTITY)
    END
     
    Update AMIELEC_MSCRM.dbo.AccountExtensionBase
    SET New_Identifiant=@identifiant_client,New_TypePersonne=@type_pers_char,New_categorie_comptable=@catcomptaChar,
    New_representant=@un_representant,New_contacts=@contact,New_descriptif=@intitule
    where New_societe=@Num
    Print('maj du client'+@num)
     
    if @@rowcount=0
    BEGIN
    insert into AMIELEC_MSCRM.dbo.AccountExtensionBase(AccountId,New_Identifiant,New_TypePersonne,New_categorie_comptable,New_representant,New_prenom_representant,New_nom_representant,New_contacts,New_societe,New_descriptif)
    values(NEWID(),@identifiant_client,@type_pers_char,@catcomptaChar,@un_representant,null,null,@contact,@num,@intitule)
    Print('insert du client'+@num)
    END
    Normalement si le nom du client n'existe pas dans AccountBAse le update ne se fera pas et 0ligne seront affectées.
    @@rowconut devrait alors prendre la valeur 0.
    Et l'insertion devrai se faire.

    ca me parait cohérent? pourtant quand je test quand un client existe dans AccountBAse il est mise à jour et inséré donc --> probleme... si il n'existe pas il est bien inserer seulement donc la tout va bien.

  6. #6
    Membre éprouvé
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Août 2006
    Messages
    730
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2006
    Messages : 730
    Points : 923
    Points
    923
    Par défaut
    tu peux utiliser le @@rowcount

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
     
    update ma_table set ...
    if @@rowcount=0 -- l'enregistrement n'existe pas, l'update n'a rien fait
      insert ...

  7. #7
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    61
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 61
    Points : 32
    Points
    32
    Par défaut
    GENIAL!!!
    donc tu me confirme dans mon idée mais dans ce cas pourquoi est ce que j'obtiens le resultat que je t'evoque dans mon dernier post c'est bizarre?

    Bon je continue de creuser!

  8. #8
    Membre éprouvé
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Août 2006
    Messages
    730
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2006
    Messages : 730
    Points : 923
    Points
    923
    Par défaut
    c'est pas ton print qui déclencherai le @@rowcount

    là, je peux pas tester, aujourd'hui je suis sous oracle

  9. #9
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    61
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 61
    Points : 32
    Points
    32
    Par défaut
    Effectivement ca semble marcher ca venait du print j'y aurais pas penser!
    Je vais tester plusieurs cas pour vérifier.

    Par contre ma procédure n'effectue les modif que sur un seul champs meme si plusieurs champs on été mise a jour dans la journée... autre probleme.

    Une nouvelle fois merci pour ton aide Serge!!!

  10. #10
    Membre éprouvé
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Août 2006
    Messages
    730
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2006
    Messages : 730
    Points : 923
    Points
    923
    Par défaut
    précises:

    tu veux faire des traitements différents suivant les champs mis a jour
    ou
    tu veux faire un traitement a chaque fois que tu as une mise a jour

  11. #11
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    61
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 61
    Points : 32
    Points
    32
    Par défaut
    C'est vrai que j'ai pas préciser désolé:
    Quand on modifie la base F_comptet je veux que ca modifie aussi la table AccountBase.
    Je pense faire les mises a jour quotidiennement donc mon curseur doit recuperer toutes les valeurs modifiées dans la journées et les mettre a jour le soir. Meme chose pour les nouveaux champs insérés.

    Ah et c'était bien le print qui posait probleme tout a l'heure!

    La procedure que j'ai créé est la:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
     
     
    --SCRIPT DE CREATION DES PROCEDURES
    --IF NOT EXISTS(SELECT 1 FROM sysobjects WHERE name='copie_client')
     
    CREATE PROCEDURE copie_client_maj(@id_client int OUTPUT)
    AS
    	--DECLARATION DES VARIABLES DE PROCEDURES
    	declare @num varchar(17), @numpayeur varchar(17), @intitule varchar(35), @contact varchar(35), @adresse varchar(35), @complement varchar(35), @code_postal varchar(9), @ville varchar(35), @pays varchar(35), @telephone varchar(21), @fax varchar(21), @mail varchar(69), @site varchar(69),@catcomptaInt int,  @type_personne int, @un_tarif int,@un_representant int
    	declare @conv_AccountId uniqueidentifier, @conv_pays uniqueidentifier, @nom_parent varchar(200), @idnom_parent uniqueidentifier, @nom_tarif varchar(50), @id_tarif uniqueidentifier, @id_utilisateur uniqueidentifier, @businness_unit uniqueidentifier,@conv_CustomerAddressId uniqueidentifier
    	declare @id int, @un_utilisateur varchar(200),@catcomptaChar varchar(35),@type_pers_char varchar(35),@identifiant_client int--,@societe varchar(100)
     
    	--DECLARATION DU CURSEUR
    	DECLARE un_curseur cursor FOR
    	select cbMarq,CT_Num,CT_NumPayeur,CT_Intitule,CT_Contact,CT_Adresse,CT_Complement,CT_CodePostal,CT_Ville,CT_Pays,CT_Telephone,CT_Telecopie,CT_EMail,CT_Site,N_CatCompta,CT_Type,N_CatTarif,RE_No from GAMIELEC.dbo.F_COMPTET
    	where @id_client=0 
    	AND CT_Intitule not like'%*%'
    	AND DATEPART(year,CBModification) = DATEPART(year,GETDATE())
    	AND DATEPART(month,CBModification) = DATEPART(month,GETDATE())
    	AND DATEPART(day,CBModification) = DATEPART(day,GETDATE())
     
    	--OUVERTURE DU CURSEUR ET LANCEMENT
    	OPEN un_curseur
    	FETCH un_curseur INTO @id, @num, @numpayeur, @intitule, @contact, @adresse, @complement, @code_postal, @ville, @pays, @telephone, @fax, @mail, @site, @catcomptaInt, @type_personne, @un_tarif,@un_representant
     
    --POUR LE PREMIER ENREGISTREMENT
     
    	--INITIALISATION DE L'IDENTIFIANT
    	SET @identifiant_client=1 
     
    	--CLEF PRIMAIRE DE LA TABLE ACCOUNTBASE généré de façon unique aléatoirement (uniqueidentifier)
    		--SET @conv_AccountId = NEWID()
    		--PRINT 'Value of @conv_AccountId is: '+ CONVERT(varchar(255), @conv_AccountId)
     
    	--CLEF PRIMAIRE DE LA TABLE CUSTOMERADDRESSEBASE généré de façon unique aléatoirement (uniqueidentifier)
    		--SET @conv_CustomerAddressId = NEWID()	
    		--PRINT 'Value of @conv_CustomerAddressId  is: '+ CONVERT(varchar(255), @conv_CustomerAddressId)
     
    	-- POUR DEFINIR LE SECTEUR DE VENTE
    	if  @pays='Secteur 1 (loire EST, Rhône)' or @pays='Secteur 1 (loire EST)' or @pays='Secteur 1 (ST Etienne Sud)' or @pays='Secteur ST Etienne Sud'
    		SET @conv_pays = '3A3A2FBA-A991-DB11-8AEE-0015E9F01122' --Loire Secteur 1 
    		--PRINT 'le secteur est :'+CONVERT(varchar(255), @conv_pays)
    		--Print 'il correspond au '+@pays
     
    	if  @pays='Secteur 2 (Loire OUEST,Puy de Dôme)' or @pays='Secteur 2 (ST Etienne Nord)' or @pays='Secteur 2 (Loire OUEST,Puy de Dôme)' or @pays='Secteur ST Etienne Nord'
    		SET @conv_pays = 'A44E7BE5-A991-DB11-8AEE-0015E9F01122' --Loire Secteur 2
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 3 (Loire NORD)'
    		SET @conv_pays = 'D2CA3902-D291-DB11-8AEE-0015E9F01122' --Loire Secteur 3
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 4 (Hte Loire EST)'
    		SET @conv_pays = 'CA8D82D9-5FE7-DB11-9FAB-0015E9F01122' --Haute-Loire Secteur 4
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 5 (Hte Loire CENTRE)'
    		SET @conv_pays = '72B9D2E2-5FE7-DB11-9FAB-0015E9F01122' --Haute-Loire Secteur 5
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 6 (Hte Loire OUEST)'
    		SET @conv_pays = '3C8401EC-5FE7-DB11-9FAB-0015E9F01122' --Haute-Loire Secteur 6
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 7 (Rhône)'
    		SET @conv_pays = '10336DCF-74EE-DB11-9FAB-0015E9F01122' --Rhone Secteur 7
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='FR08304505050' or @pays='Secteur 9 (autres départements)'
    		SET @conv_pays = 'C9560984-74EE-DB11-9FAB-0015E9F01122' --autres departements Secteur 9
    		-- 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	--POUR DEFINIR LE COMPTE PARENT
    	if @Type_personne = 0
    		SET @nom_parent = 'compte client général : 401000'
    	if @Type_personne = 0		
    		SET @idnom_parent='9AF3FE84-7BF9-DB11-8E15-0015E9F01122'
    	if @Type_personne = 1
    		SET @nom_parent = 'compte fournisseur général : 411000'
    	if @Type_personne = 1
    		SET @idnom_parent='E48C5C8F-7BF9-DB11-8E15-0015E9F01122'
     
    	--POUR DEFINIR LES TARIFS
    	if @un_tarif=1
    		SET @nom_tarif='Prix de vente HT'
    		SET @id_tarif='E4A28B1D-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=2
    		SET @nom_tarif='Prix de vente TTC'
    		SET @id_tarif='D81A6627-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=3
    		SET @nom_tarif='Prix Public HT'
    		SET @id_tarif='3AC15232-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=4
    		SET @nom_tarif='Prix Public TTC'
    		SET @id_tarif='D076A142-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=5
    		SET @nom_tarif='Internet HT'
    		SET @id_tarif='30E6354D-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=6
    		SET @nom_tarif='Internet TTC'	
    		SET @id_tarif='9E7CD157-FAF3-DB11-9FAB-0015E9F01122'
     
    	--POUR DEFINIR LE TYPE DE COMPTE
    	if @type_personne=0
    		SET @type_pers_char='Client'
    	if @type_personne=1
    		SET @type_pers_char='Fournisseur'
    	if @type_personne=2
    		SET @type_pers_char='Salarié'
    	if @type_personne=3
    	 	SET @type_pers_char='Autres'	
     
    	--POUR DEFINIR LA CATEGORIE COMPTABLE
    	if @catcomptaInt=1 	
    		SET @catcomptaChar='Secteur vente 42'
    	if @catcomptaInt=1 
    		SET @catcomptaInt=42
    	if @catcomptaInt=2	
    		SET @catcomptaChar='Secteur vente 43'
    	if @catcomptaInt=2
    		SET @catcomptaInt=43	
    	if @catcomptaInt=3 
    		SET @catcomptaChar='Secteur HT export'
    	if @catcomptaInt=3 
    		SET @catcomptaInt=0
    	if @catcomptaInt=4 
    		SET @catcomptaChar='Secteur vente 69'
    	if @catcomptaInt=4 
    		SET @catcomptaInt=69	
     
    	--POUR DEFINIR LE PROPRIETAIRE DES DONNEES ET SA DIVISION ASSOCIEE
    	SET @un_utilisateur='DOMAMIELEC\CRMadmin'
    	SET @id_utilisateur='50F3DA06-2E90-DB11-996E-0015E9F01122'
    	SET @businness_unit='CA227FFA-2D90-DB11-996E-0015E9F01122'
     
    --TANT QUE LE CURSEUR CONTIENT DES DONNEES
    WHILE @@FETCH_STATUS = 0
    BEGIN	
     
    	--LANCEMENT DU CURSEUR
    	--PRINT 'Le nom du client avant copie est :'+@num
    	FETCH NEXT FROM un_curseur INTO @id, @num, @numpayeur, @intitule, @contact, @adresse, @complement, @code_postal, @ville, @pays, @telephone, @fax, @mail, @site, @catcomptaInt, @type_personne, @un_tarif,@un_representant
    	--PRINT 'Le nom du client apres copie est :'+@num
     
    	--INCREMENTATION DE L'IDENTIFIANT
    	SET @identifiant_client=@identifiant_client+1 
     
    	--CLEF PRIMAIRE DE LA TABLE ACCOUNTBASE généré de façon unique aléatoirement (uniqueidentifier)
    		--SET @conv_AccountId = NEWID()
    		--PRINT 'Value of @conv_AccountId is: '+ CONVERT(varchar(255), @conv_AccountId)
     
    	--CLEF PRIMAIRE DE LA TABLE CUSTOMERADDRESSEBASE généré de façon unique aléatoirement (uniqueidentifier)
    		--SET @conv_CustomerAddressId = NEWID()	
    		--PRINT 'Value of @conv_CustomerAddressId  is: '+ CONVERT(varchar(255), @conv_CustomerAddressId)
     
    	-- POUR DEFINIR LE SECTEUR DE VENTE
    	if  @pays='Secteur 1 (loire EST, Rhône)' or @pays='Secteur 1 (loire EST)' or @pays='Secteur 1 (ST Etienne Sud)' or @pays='Secteur ST Etienne Sud'
    		SET @conv_pays = '3A3A2FBA-A991-DB11-8AEE-0015E9F01122' --Loire Secteur 1 
    		--PRINT 'le secteur est :'+CONVERT(varchar(255), @conv_pays)
    		--Print 'il correspond au '+@pays
     
    	if  @pays='Secteur 2 (Loire OUEST,Puy de Dôme)' or @pays='Secteur 2 (ST Etienne Nord)' or @pays='Secteur 2 (Loire OUEST,Puy de Dôme)' or @pays='Secteur ST Etienne Nord'
    		SET @conv_pays = 'A44E7BE5-A991-DB11-8AEE-0015E9F01122' --Loire Secteur 2
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 3 (Loire NORD)'
    		SET @conv_pays = 'D2CA3902-D291-DB11-8AEE-0015E9F01122' --Loire Secteur 3
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 4 (Hte Loire EST)'
    		SET @conv_pays = 'CA8D82D9-5FE7-DB11-9FAB-0015E9F01122' --Haute-Loire Secteur 4
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 5 (Hte Loire CENTRE)'
    		SET @conv_pays = '72B9D2E2-5FE7-DB11-9FAB-0015E9F01122' --Haute-Loire Secteur 5
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 6 (Hte Loire OUEST)'
    		SET @conv_pays = '3C8401EC-5FE7-DB11-9FAB-0015E9F01122' --Haute-Loire Secteur 6
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 7 (Rhône)'
    		SET @conv_pays = '10336DCF-74EE-DB11-9FAB-0015E9F01122' --Rhone Secteur 7
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='FR08304505050' or @pays='Secteur 9 (autres départements)'
    		SET @conv_pays = 'C9560984-74EE-DB11-9FAB-0015E9F01122' --autres departements Secteur 9
    		-- 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	--POUR DEFINIR LE COMPTE PARENT
    	if @Type_personne = 0
    		SET @nom_parent = 'compte client général : 401000'
    	if @Type_personne = 0		
    		SET @idnom_parent='9AF3FE84-7BF9-DB11-8E15-0015E9F01122'
    	if @Type_personne = 1
    		SET @nom_parent = 'compte fournisseur général : 411000'
    	if @Type_personne = 1
    		SET @idnom_parent='E48C5C8F-7BF9-DB11-8E15-0015E9F01122'
     
    	--POUR DEFINIR LES TARIFS
    	if @un_tarif=1
    		SET @nom_tarif='Prix de vente HT'
    		SET @id_tarif='E4A28B1D-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=2
    		SET @nom_tarif='Prix de vente TTC'
    		SET @id_tarif='D81A6627-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=3
    		SET @nom_tarif='Prix Public HT'
    		SET @id_tarif='3AC15232-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=4
    		SET @nom_tarif='Prix Public TTC'
    		SET @id_tarif='D076A142-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=5
    		SET @nom_tarif='Internet HT'
    		SET @id_tarif='30E6354D-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=6
    		SET @nom_tarif='Internet TTC'	
    		SET @id_tarif='9E7CD157-FAF3-DB11-9FAB-0015E9F01122'
     
    	--POUR DEFINIR LE TYPE DE COMPTE
    	if @type_personne=0
    		SET @type_pers_char='Client'
    	if @type_personne=1
    		SET @type_pers_char='Fournisseur'
    	if @type_personne=2
    		SET @type_pers_char='Salarié'
    	if @type_personne=3
    	 	SET @type_pers_char='Autres'	
     
    	--POUR DEFINIR LA CATEGORIE COMPTABLE
    	if @catcomptaInt=1 	
    		SET @catcomptaChar='Secteur vente 42'
    	if @catcomptaInt=1 
    		SET @catcomptaInt=42
    	if @catcomptaInt=2	
    		SET @catcomptaChar='Secteur vente 43'
    	if @catcomptaInt=2
    		SET @catcomptaInt=43	
    	if @catcomptaInt=3 
    		SET @catcomptaChar='Secteur HT export'
    	if @catcomptaInt=3 
    		SET @catcomptaInt=0
    	if @catcomptaInt=4 
    		SET @catcomptaChar='Secteur vente 69'
    	if @catcomptaInt=4 
    		SET @catcomptaInt=69	
     
    --MISE A JOUR DANS LES TABLES DE LA CRM
     
    Update AMIELEC_MSCRM.dbo.AccountBase
    SET AccountCategoryCode=@catcomptaInt,TerritoryId=@conv_pays,DefaultPriceLevelId=@id_tarif,
    OwningUser=@id_utilisateur,AccountNumber=@numpayeur,Description=@intitule,WebSiteURL=@site,EMailAddress1=@mail,
    Telephone1=@telephone,Fax=@fax,ParentAccountId=@idnom_parent,StatusCode=1,StateCode=0,DeletionStateCode=0
    where Name=@Num 
    --Print('maj AccountBase du client'+@num)
    --print(@@rowcount)
     
    if @@rowcount=0
    --INSERTION DANS LES TABLES DE LA CRM
    insert into AMIELEC_MSCRM.dbo.AccountBase(AccountId,OwningBusinessUnit,AccountCategoryCode,TerritoryId,DefaultPriceLevelId,
    CustomerSizeCode,PreferredContactMethodCode,PreferredAppointmentDayCode,PreferredAppointmentTimeCode,CustomerTypeCode,AccountRatingCode,IndustryCode,TerritoryCode,
    AccountClassificationCode,BusinessTypeCode,OwningUser,OriginatingLeadId,PrimaryContactId,Name,AccountNumber,Revenue,NumberOfEmployees,Description,SIC,OwnershipCode,MarketCap,
    SharesOutstanding,TickerSymbol,StockExchange,WebSiteURL,FtpSiteURL,EMailAddress1,EMailAddress2,EMailAddress3,Telephone1,DoNotPhone,DoNotFax,DoNotEMail,DoNotSendMM,DoNotPostalMail,DoNotBulkEMail,DoNotBulkPostalMail,
    Telephone2,Fax,Telephone3,CreditLimit,CreditOnHold,ParentAccountId,StatusCode,StateCode,DeletionStateCode)
    values(NEWID(),@businness_unit,@catcomptaInt,@conv_pays,@id_tarif,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,@id_utilisateur,
    Null,Null,@num,@numpayeur,Null,Null,@intitule,Null,Null,Null,Null,Null,Null,@site,Null,@mail,Null,Null,@telephone,0,0,0,0,0,0,Null,Null,@fax,Null,Null,Null,@idnom_parent,1,0,0)
    --Print('insert AccountBAse du client'+@num)
    --print(@@rowcount)
     
    Update AMIELEC_MSCRM.dbo.AccountExtensionBase
    SET New_Identifiant=@identifiant_client,New_TypePersonne=@type_pers_char,New_categorie_comptable=@catcomptaChar,
    New_representant=@un_representant,New_contacts=@contact,New_descriptif=@intitule
    where New_societe=@Num
    --Print('maj Extension BAse du client'+@num)
    --print(@@rowcount)
     
    if @@rowcount=0
    insert into AMIELEC_MSCRM.dbo.AccountExtensionBase(AccountId,New_Identifiant,New_TypePersonne,New_categorie_comptable,New_representant,New_prenom_representant,New_nom_representant,New_contacts,New_societe,New_descriptif)
    values(NEWID(),@identifiant_client,@type_pers_char,@catcomptaChar,@un_representant,null,null,@contact,@num,@intitule)
    --Print('insert Extension BAse du client'+@num)
    --print(@@rowcount)
     
    Update AMIELEC_MSCRM.dbo.CustomerAddressBase
    SET Name=@adresse,Line1=@complement,PostalCode=@code_postal,City=@ville,ObjectTypeCode=1,DeletionStateCode=0,AddressNumber=1
    where Name=@adresse 
     
    if @@rowcount=0
    insert into AMIELEC_MSCRM.dbo.CustomerAddressBase(Name,Line1,PostalCode,City,ObjectTypeCode,DeletionStateCode,CustomerAddressId,ParentId,AddressNumber)
    values(@adresse,@complement,@code_postal,@ville,1,0,NEWID(),NEWID(),1)
     
    END
    --FERMETURE ET DESALLOCAION DU CURSEUR
    CLOSE un_curseur
    DEALLOCATE un_curseur
    GO

  12. #12
    Membre éprouvé
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Août 2006
    Messages
    730
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2006
    Messages : 730
    Points : 923
    Points
    923
    Par défaut
    j'ai toujours par compris;

    ton champ CBmodification est mis a jour a chaque fois que tu modifies un (et n'importe lequel) champ de F_complet => donc même si on en modifie 2 le meme jour tu récupères la dernière MAJ (vrai ou faux)

    comment tu sais qu'une ligne a été insérée dans F_complet ?

  13. #13
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    61
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 61
    Points : 32
    Points
    32
    Par défaut
    Oui c'est exact je recupererait la derniere modif ou plutot l'ensemble des champs tels qui seront aprés la derniere modif.
    pour l'insertion dans Fcomptet c'est grace a CBmodification également que je sais si un champs est inseré ou non.
    Il se créé avec la date du jour en cas de nouvelle insertion.

    Maintenat grace au @@rowcount je sas si cé une insertion ou une maj!

    J'ai résolu mon probleme de toute a l'heure! Un fetch mal palcé...

    Je fais des tests et je te tiens au courant du résultat...

    Merci infinement pour to aide!!!

  14. #14
    Membre éprouvé
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Août 2006
    Messages
    730
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2006
    Messages : 730
    Points : 923
    Points
    923
    Par défaut
    en revanche ta proc de 306 lignes peut être réduite a 50

    envoies la dernière version et je te le fais

  15. #15
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    61
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 61
    Points : 32
    Points
    32
    Par défaut
    je pense voir ce que tu veux dire les données dupliquées peuvent etre évitées?

    voila la procédure :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
     
    CREATE PROCEDURE copie_client_maj(@id_client int OUTPUT)
    AS
    	--DECLARATION DES VARIABLES DE PROCEDURES
    	declare @num varchar(17), @numpayeur varchar(17), @intitule varchar(35), @contact varchar(35), @adresse varchar(35), @complement varchar(35), @code_postal varchar(9), @ville varchar(35), @pays varchar(35), @telephone varchar(21), @fax varchar(21), @mail varchar(69), @site varchar(69),@catcomptaInt int,  @type_personne int, @un_tarif int,@un_representant int
    	declare @conv_AccountId uniqueidentifier, @conv_pays uniqueidentifier, @nom_parent varchar(200), @idnom_parent uniqueidentifier, @nom_tarif varchar(50), @id_tarif uniqueidentifier, @id_utilisateur uniqueidentifier, @businness_unit uniqueidentifier,@conv_CustomerAddressId uniqueidentifier
    	declare @id int, @un_utilisateur varchar(200),@catcomptaChar varchar(35),@type_pers_char varchar(35),@identifiant_client int--,@societe varchar(100)
     
    	--DECLARATION DU CURSEUR
    	DECLARE un_curseur cursor FOR
    	select cbMarq,CT_Num,CT_NumPayeur,CT_Intitule,CT_Contact,CT_Adresse,CT_Complement,CT_CodePostal,CT_Ville,CT_Pays,CT_Telephone,CT_Telecopie,CT_EMail,CT_Site,N_CatCompta,CT_Type,N_CatTarif,RE_No from GAMIELEC.dbo.F_COMPTET
    	where @id_client=0 
    	AND CT_Intitule not like'%*%'
    	AND DATEPART(year,CBModification) = DATEPART(year,GETDATE())
    	AND DATEPART(month,CBModification) = DATEPART(month,GETDATE())
    	AND DATEPART(day,CBModification) = DATEPART(day,GETDATE())
     
    	--OUVERTURE DU CURSEUR ET LANCEMENT
    	OPEN un_curseur
    	FETCH un_curseur INTO @id, @num, @numpayeur, @intitule, @contact, @adresse, @complement, @code_postal, @ville, @pays, @telephone, @fax, @mail, @site, @catcomptaInt, @type_personne, @un_tarif,@un_representant
     
    --POUR LE PREMIER ENREGISTREMENT
     
    	--INITIALISATION DE L'IDENTIFIANT
    	SET @identifiant_client=1 
     
    	--CLEF PRIMAIRE DE LA TABLE ACCOUNTBASE généré de façon unique aléatoirement (uniqueidentifier)
    		--SET @conv_AccountId = NEWID()
    		--PRINT 'Value of @conv_AccountId is: '+ CONVERT(varchar(255), @conv_AccountId)
     
    	--CLEF PRIMAIRE DE LA TABLE CUSTOMERADDRESSEBASE généré de façon unique aléatoirement (uniqueidentifier)
    		--SET @conv_CustomerAddressId = NEWID()	
    		--PRINT 'Value of @conv_CustomerAddressId  is: '+ CONVERT(varchar(255), @conv_CustomerAddressId)
     
    	-- POUR DEFINIR LE SECTEUR DE VENTE
    	if  @pays='Secteur 1 (loire EST, Rhône)' or @pays='Secteur 1 (loire EST)' or @pays='Secteur 1 (ST Etienne Sud)' or @pays='Secteur ST Etienne Sud'
    		SET @conv_pays = '3A3A2FBA-A991-DB11-8AEE-0015E9F01122' --Loire Secteur 1 
    		--PRINT 'le secteur est :'+CONVERT(varchar(255), @conv_pays)
    		--Print 'il correspond au '+@pays
     
    	if  @pays='Secteur 2 (Loire OUEST,Puy de Dôme)' or @pays='Secteur 2 (ST Etienne Nord)' or @pays='Secteur 2 (Loire OUEST,Puy de Dôme)' or @pays='Secteur ST Etienne Nord'
    		SET @conv_pays = 'A44E7BE5-A991-DB11-8AEE-0015E9F01122' --Loire Secteur 2
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 3 (Loire NORD)'
    		SET @conv_pays = 'D2CA3902-D291-DB11-8AEE-0015E9F01122' --Loire Secteur 3
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 4 (Hte Loire EST)'
    		SET @conv_pays = 'CA8D82D9-5FE7-DB11-9FAB-0015E9F01122' --Haute-Loire Secteur 4
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 5 (Hte Loire CENTRE)'
    		SET @conv_pays = '72B9D2E2-5FE7-DB11-9FAB-0015E9F01122' --Haute-Loire Secteur 5
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 6 (Hte Loire OUEST)'
    		SET @conv_pays = '3C8401EC-5FE7-DB11-9FAB-0015E9F01122' --Haute-Loire Secteur 6
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 7 (Rhône)'
    		SET @conv_pays = '10336DCF-74EE-DB11-9FAB-0015E9F01122' --Rhone Secteur 7
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='FR08304505050' or @pays='Secteur 9 (autres départements)'
    		SET @conv_pays = 'C9560984-74EE-DB11-9FAB-0015E9F01122' --autres departements Secteur 9
    		-- 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	--POUR DEFINIR LE COMPTE PARENT
    	if @Type_personne = 0
    		SET @nom_parent = 'compte client général : 401000'
    	if @Type_personne = 0		
    		SET @idnom_parent='9AF3FE84-7BF9-DB11-8E15-0015E9F01122'
    	if @Type_personne = 1
    		SET @nom_parent = 'compte fournisseur général : 411000'
    	if @Type_personne = 1
    		SET @idnom_parent='E48C5C8F-7BF9-DB11-8E15-0015E9F01122'
     
    	--POUR DEFINIR LES TARIFS
    	if @un_tarif=1
    		SET @nom_tarif='Prix de vente HT'
    		SET @id_tarif='E4A28B1D-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=2
    		SET @nom_tarif='Prix de vente TTC'
    		SET @id_tarif='D81A6627-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=3
    		SET @nom_tarif='Prix Public HT'
    		SET @id_tarif='3AC15232-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=4
    		SET @nom_tarif='Prix Public TTC'
    		SET @id_tarif='D076A142-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=5
    		SET @nom_tarif='Internet HT'
    		SET @id_tarif='30E6354D-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=6
    		SET @nom_tarif='Internet TTC'	
    		SET @id_tarif='9E7CD157-FAF3-DB11-9FAB-0015E9F01122'
     
    	--POUR DEFINIR LE TYPE DE COMPTE
    	if @type_personne=0
    		SET @type_pers_char='Client'
    	if @type_personne=1
    		SET @type_pers_char='Fournisseur'
    	if @type_personne=2
    		SET @type_pers_char='Salarié'
    	if @type_personne=3
    	 	SET @type_pers_char='Autres'	
     
    	--POUR DEFINIR LA CATEGORIE COMPTABLE
    	if @catcomptaInt=1 	
    		SET @catcomptaChar='Secteur vente 42'
    	if @catcomptaInt=1 
    		SET @catcomptaInt=42
    	if @catcomptaInt=2	
    		SET @catcomptaChar='Secteur vente 43'
    	if @catcomptaInt=2
    		SET @catcomptaInt=43	
    	if @catcomptaInt=3 
    		SET @catcomptaChar='Secteur HT export'
    	if @catcomptaInt=3 
    		SET @catcomptaInt=0
    	if @catcomptaInt=4 
    		SET @catcomptaChar='Secteur vente 69'
    	if @catcomptaInt=4 
    		SET @catcomptaInt=69	
     
    	--POUR DEFINIR LE PROPRIETAIRE DES DONNEES ET SA DIVISION ASSOCIEE
    	SET @un_utilisateur='DOMAMIELEC\CRMadmin'
    	SET @id_utilisateur='50F3DA06-2E90-DB11-996E-0015E9F01122'
    	SET @businness_unit='CA227FFA-2D90-DB11-996E-0015E9F01122'
     
    --TANT QUE LE CURSEUR CONTIENT DES DONNEES
    WHILE @@FETCH_STATUS = 0
    BEGIN	
     
    	--LANCEMENT DU CURSEUR
    	--PRINT 'Le nom du client avant copie est :'+@num
    	--FETCH NEXT FROM un_curseur INTO @id, @num, @numpayeur, @intitule, @contact, @adresse, @complement, @code_postal, @ville, @pays, @telephone, @fax, @mail, @site, @catcomptaInt, @type_personne, @un_tarif,@un_representant
    	--PRINT 'Le nom du client apres copie est :'+@num
     
    	--INCREMENTATION DE L'IDENTIFIANT
    	SET @identifiant_client=@identifiant_client+1 
     
    	--CLEF PRIMAIRE DE LA TABLE ACCOUNTBASE généré de façon unique aléatoirement (uniqueidentifier)
    		--SET @conv_AccountId = NEWID()
    		--PRINT 'Value of @conv_AccountId is: '+ CONVERT(varchar(255), @conv_AccountId)
     
    	--CLEF PRIMAIRE DE LA TABLE CUSTOMERADDRESSEBASE généré de façon unique aléatoirement (uniqueidentifier)
    		--SET @conv_CustomerAddressId = NEWID()	
    		--PRINT 'Value of @conv_CustomerAddressId  is: '+ CONVERT(varchar(255), @conv_CustomerAddressId)
     
    	-- POUR DEFINIR LE SECTEUR DE VENTE
    	if  @pays='Secteur 1 (loire EST, Rhône)' or @pays='Secteur 1 (loire EST)' or @pays='Secteur 1 (ST Etienne Sud)' or @pays='Secteur ST Etienne Sud'
    		SET @conv_pays = '3A3A2FBA-A991-DB11-8AEE-0015E9F01122' --Loire Secteur 1 
    		--PRINT 'le secteur est :'+CONVERT(varchar(255), @conv_pays)
    		--Print 'il correspond au '+@pays
     
    	if  @pays='Secteur 2 (Loire OUEST,Puy de Dôme)' or @pays='Secteur 2 (ST Etienne Nord)' or @pays='Secteur 2 (Loire OUEST,Puy de Dôme)' or @pays='Secteur ST Etienne Nord'
    		SET @conv_pays = 'A44E7BE5-A991-DB11-8AEE-0015E9F01122' --Loire Secteur 2
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 3 (Loire NORD)'
    		SET @conv_pays = 'D2CA3902-D291-DB11-8AEE-0015E9F01122' --Loire Secteur 3
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 4 (Hte Loire EST)'
    		SET @conv_pays = 'CA8D82D9-5FE7-DB11-9FAB-0015E9F01122' --Haute-Loire Secteur 4
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 5 (Hte Loire CENTRE)'
    		SET @conv_pays = '72B9D2E2-5FE7-DB11-9FAB-0015E9F01122' --Haute-Loire Secteur 5
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 6 (Hte Loire OUEST)'
    		SET @conv_pays = '3C8401EC-5FE7-DB11-9FAB-0015E9F01122' --Haute-Loire Secteur 6
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='Secteur 7 (Rhône)'
    		SET @conv_pays = '10336DCF-74EE-DB11-9FAB-0015E9F01122' --Rhone Secteur 7
    		--PRINT 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	if @pays='FR08304505050' or @pays='Secteur 9 (autres départements)'
    		SET @conv_pays = 'C9560984-74EE-DB11-9FAB-0015E9F01122' --autres departements Secteur 9
    		-- 'le secteur est :'+ CONVERT(varchar(255), @conv_pays)	
    		--Print 'il correspond au '+@pays
     
    	--POUR DEFINIR LE COMPTE PARENT
    	if @Type_personne = 0
    		SET @nom_parent = 'compte client général : 401000'
    	if @Type_personne = 0		
    		SET @idnom_parent='9AF3FE84-7BF9-DB11-8E15-0015E9F01122'
    	if @Type_personne = 1
    		SET @nom_parent = 'compte fournisseur général : 411000'
    	if @Type_personne = 1
    		SET @idnom_parent='E48C5C8F-7BF9-DB11-8E15-0015E9F01122'
     
    	--POUR DEFINIR LES TARIFS
    	if @un_tarif=1
    		SET @nom_tarif='Prix de vente HT'
    		SET @id_tarif='E4A28B1D-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=2
    		SET @nom_tarif='Prix de vente TTC'
    		SET @id_tarif='D81A6627-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=3
    		SET @nom_tarif='Prix Public HT'
    		SET @id_tarif='3AC15232-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=4
    		SET @nom_tarif='Prix Public TTC'
    		SET @id_tarif='D076A142-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=5
    		SET @nom_tarif='Internet HT'
    		SET @id_tarif='30E6354D-FAF3-DB11-9FAB-0015E9F01122'
    	if @un_tarif=6
    		SET @nom_tarif='Internet TTC'	
    		SET @id_tarif='9E7CD157-FAF3-DB11-9FAB-0015E9F01122'
     
    	--POUR DEFINIR LE TYPE DE COMPTE
    	if @type_personne=0
    		SET @type_pers_char='Client'
    	if @type_personne=1
    		SET @type_pers_char='Fournisseur'
    	if @type_personne=2
    		SET @type_pers_char='Salarié'
    	if @type_personne=3
    	 	SET @type_pers_char='Autres'	
     
    	--POUR DEFINIR LA CATEGORIE COMPTABLE
    	if @catcomptaInt=1 	
    		SET @catcomptaChar='Secteur vente 42'
    	if @catcomptaInt=1 
    		SET @catcomptaInt=42
    	if @catcomptaInt=2	
    		SET @catcomptaChar='Secteur vente 43'
    	if @catcomptaInt=2
    		SET @catcomptaInt=43	
    	if @catcomptaInt=3 
    		SET @catcomptaChar='Secteur HT export'
    	if @catcomptaInt=3 
    		SET @catcomptaInt=0
    	if @catcomptaInt=4 
    		SET @catcomptaChar='Secteur vente 69'
    	if @catcomptaInt=4 
    		SET @catcomptaInt=69	
     
    --MISE A JOUR DANS LES TABLES DE LA CRM
     
    Update AMIELEC_MSCRM.dbo.AccountBase
    SET AccountCategoryCode=@catcomptaInt,TerritoryId=@conv_pays,DefaultPriceLevelId=@id_tarif,
    OwningUser=@id_utilisateur,AccountNumber=@numpayeur,Description=@intitule,WebSiteURL=@site,EMailAddress1=@mail,
    Telephone1=@telephone,Fax=@fax,ParentAccountId=@idnom_parent,StatusCode=1,StateCode=0,DeletionStateCode=0
    where Name=@Num 
    --Print('maj AccountBase du client'+@num)
    --print(@@rowcount)
     
    if @@rowcount=0
    --INSERTION DANS LES TABLES DE LA CRM
    insert into AMIELEC_MSCRM.dbo.AccountBase(AccountId,OwningBusinessUnit,AccountCategoryCode,TerritoryId,DefaultPriceLevelId,
    CustomerSizeCode,PreferredContactMethodCode,PreferredAppointmentDayCode,PreferredAppointmentTimeCode,CustomerTypeCode,AccountRatingCode,IndustryCode,TerritoryCode,
    AccountClassificationCode,BusinessTypeCode,OwningUser,OriginatingLeadId,PrimaryContactId,Name,AccountNumber,Revenue,NumberOfEmployees,Description,SIC,OwnershipCode,MarketCap,
    SharesOutstanding,TickerSymbol,StockExchange,WebSiteURL,FtpSiteURL,EMailAddress1,EMailAddress2,EMailAddress3,Telephone1,DoNotPhone,DoNotFax,DoNotEMail,DoNotSendMM,DoNotPostalMail,DoNotBulkEMail,DoNotBulkPostalMail,
    Telephone2,Fax,Telephone3,CreditLimit,CreditOnHold,ParentAccountId,StatusCode,StateCode,DeletionStateCode)
    values(NEWID(),@businness_unit,@catcomptaInt,@conv_pays,@id_tarif,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,@id_utilisateur,
    Null,Null,@num,@numpayeur,Null,Null,@intitule,Null,Null,Null,Null,Null,Null,@site,Null,@mail,Null,Null,@telephone,0,0,0,0,0,0,Null,Null,@fax,Null,Null,Null,@idnom_parent,1,0,0)
    --Print('insert AccountBAse du client'+@num)
    --print(@@rowcount)
     
    Update AMIELEC_MSCRM.dbo.AccountExtensionBase
    SET New_Identifiant=@identifiant_client,New_TypePersonne=@type_pers_char,New_categorie_comptable=@catcomptaChar,
    New_representant=@un_representant,New_contacts=@contact,New_descriptif=@intitule
    where New_societe=@Num
    --Print('maj Extension BAse du client'+@num)
    --print(@@rowcount)
     
    if @@rowcount=0
    insert into AMIELEC_MSCRM.dbo.AccountExtensionBase(AccountId,New_Identifiant,New_TypePersonne,New_categorie_comptable,New_representant,New_prenom_representant,New_nom_representant,New_contacts,New_societe,New_descriptif)
    values(NEWID(),@identifiant_client,@type_pers_char,@catcomptaChar,@un_representant,null,null,@contact,@num,@intitule)
    --Print('insert Extension BAse du client'+@num)
    --print(@@rowcount)
     
    Update AMIELEC_MSCRM.dbo.CustomerAddressBase
    SET Name=@adresse,Line1=@complement,PostalCode=@code_postal,City=@ville,ObjectTypeCode=1,DeletionStateCode=0,AddressNumber=1
    where Telephone1=@telephone
     
    if @@rowcount=0
    insert into AMIELEC_MSCRM.dbo.CustomerAddressBase(Name,Line1,PostalCode,City,ObjectTypeCode,DeletionStateCode,CustomerAddressId,ParentId,AddressNumber)
    values(@adresse,@complement,@code_postal,@ville,1,0,NEWID(),NEWID(),1)
     
    FETCH NEXT FROM un_curseur INTO @id, @num, @numpayeur, @intitule, @contact, @adresse, @complement, @code_postal, @ville, @pays, @telephone, @fax, @mail, @site, @catcomptaInt, @type_personne, @un_tarif,@un_representant
    END
    --FERMETURE ET DESALLOCAION DU CURSEUR
    CLOSE un_curseur
    DEALLOCATE un_curseur
    GO

  16. #16
    Membre éprouvé
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Août 2006
    Messages
    730
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2006
    Messages : 730
    Points : 923
    Points
    923
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
     
     
    CREATE PROCEDURE copie_client_maj(@id_client int OUTPUT)
    AS
    	--DECLARATION DES VARIABLES DE PROCEDURES
    	declare @num varchar(17), @numpayeur varchar(17), @intitule varchar(35), @contact varchar(35), @adresse varchar(35), @complement varchar(35), @code_postal varchar(9), @ville varchar(35), @pays varchar(35), @telephone varchar(21), @fax varchar(21), @mail varchar(69), @site varchar(69),@catcomptaInt int,  @type_personne int, @un_tarif int,@un_representant int
    	declare @conv_AccountId uniqueidentifier, @conv_pays uniqueidentifier, @nom_parent varchar(200), @idnom_parent uniqueidentifier, @nom_tarif varchar(50), @id_tarif uniqueidentifier, @id_utilisateur uniqueidentifier, @businness_unit uniqueidentifier,@conv_CustomerAddressId uniqueidentifier
    	declare @id int, @un_utilisateur varchar(200),@catcomptaChar varchar(35),@type_pers_char varchar(35),@identifiant_client int--,@societe varchar(100)
     
    	--DECLARATION DU CURSEUR
    	DECLARE un_curseur cursor FOR
    	SELECT cbMarq,CT_Num,CT_NumPayeur,CT_Intitule,CT_Contact,CT_Adresse,CT_Complement,CT_CodePostal,CT_Ville,
    	case CT_Pays
    	when 'Secteur 1 (loire EST, Rhône)' then '3A3A2FBA-A991-DB11-8AEE-0015E9F01122'
    	when 'Secteur 1 (loire EST)' then '3A3A2FBA-A991-DB11-8AEE-0015E9F01122'
    	when 'Secteur 1 (ST Etienne Sud)' then '3A3A2FBA-A991-DB11-8AEE-0015E9F01122'
    	when 'Secteur ST Etienne Sud' then '3A3A2FBA-A991-DB11-8AEE-0015E9F01122'
    	when 'Secteur 2 (Loire OUEST,Puy de Dôme)' then 'A44E7BE5-A991-DB11-8AEE-0015E9F01122'
    	when 'Secteur 2 (ST Etienne Nord)' then 'A44E7BE5-A991-DB11-8AEE-0015E9F01122'
    	when 'Secteur 2 (Loire OUEST,Puy de Dôme)' then 'A44E7BE5-A991-DB11-8AEE-0015E9F01122'
    	when 'Secteur ST Etienne Nord' then 'A44E7BE5-A991-DB11-8AEE-0015E9F01122'
    	when 'Secteur 3 (Loire NORD)' then 'D2CA3902-D291-DB11-8AEE-0015E9F01122'
    	when 'Secteur 4 (Hte Loire EST)' then 'CA8D82D9-5FE7-DB11-9FAB-0015E9F01122'
    	when 'Secteur 5 (Hte Loire CENTRE)' then '72B9D2E2-5FE7-DB11-9FAB-0015E9F01122'
    	when 'Secteur 6 (Hte Loire OUEST)' then '3C8401EC-5FE7-DB11-9FAB-0015E9F01122'
    	when 'Secteur 7 (Rhône)' then '10336DCF-74EE-DB11-9FAB-0015E9F01122'
    	when 'Secteur 9 (autres départements)' then 'C9560984-74EE-DB11-9FAB-0015E9F01122'
    	when 'FR08304505050' then 'C9560984-74EE-DB11-9FAB-0015E9F01122'
    	end,CT_Telephone,CT_Telecopie,CT_EMail,CT_Site,
    	case N_CatCompta
    	when 1 then 42
    	when 2 then 43
    	when 3 then 0
    	when 4 then 69
    	end,
    	case N_CatCompta
    	when 1 then 'Secteur vente 42'
    	when 2 then 'Secteur vente 43'
    	when 3 then 'Secteur HT export'
    	when 4 then 'Secteur vente 69'
    	end,
    	case CT_Type
    	when 0 then 'compte client général : 401000'
    	when 1 then 'compte fournisseur général : 411000'
    	end,
    	case CT_Type
    	when 0 then '9AF3FE84-7BF9-DB11-8E15-0015E9F01122'
    	when 1 then 'E48C5C8F-7BF9-DB11-8E15-0015E9F01122'
    	end,
    	case CT_Type
    	when 0 then 'Client'
    	when 1 then 'Fournisseur'
    	when 2 then 'Salarié'
    	when 3 then 'Autres'	
    	end,
    	case N_CatTarif
    	when 1 then 'Prix de vente HT'
    	when 2 then 'Prix de vente TTC'
    	when 3 then 'Prix Public HT'
    	when 4 then 'Prix Public TTC'
    	when 5 then 'Internet HT'
    	when 6 then 'Internet TTC'	
    	end,
    	case N_CatTarif
    	when 1 then 'E4A28B1D-FAF3-DB11-9FAB-0015E9F01122'
    	when 2 then 'D81A6627-FAF3-DB11-9FAB-0015E9F01122'
    	when 3 then '3AC15232-FAF3-DB11-9FAB-0015E9F01122'
    	when 4 then 'D076A142-FAF3-DB11-9FAB-0015E9F01122'
    	when 5 then '30E6354D-FAF3-DB11-9FAB-0015E9F01122'
    	when 6 then '9E7CD157-FAF3-DB11-9FAB-0015E9F01122'
    	end,
    	RE_No FROM GAMIELEC.dbo.F_COMPTET
    	WHERE @id_client=0 
    	AND CT_Intitule NOT LIKE'%*%'
    	AND DATEPART(year,CBModification) = DATEPART(year,GETDATE())
    	AND DATEPART(month,CBModification) = DATEPART(month,GETDATE())
    	AND DATEPART(day,CBModification) = DATEPART(day,GETDATE())
     
    	--OUVERTURE DU CURSEUR ET LANCEMENT
    	OPEN un_curseur
    	FETCH un_curseur INTO @id, @num, @numpayeur, @intitule, @contact, @adresse, @complement, @code_postal, @ville, 
    	   @conv_pays, @telephone, @fax, @mail, @site,@catcomptaInt,@catcomptaChar, @nom_parent,@idnom_parent, @type_pers_char,
    	   @nom_tarif, @id_tarif,@un_representant
     
    	--INITIALISATION DE L'IDENTIFIANT
    	SET @identifiant_client=1 
     
     
    	--POUR DEFINIR LA CATEGORIE COMPTABLE
     
    	--POUR DEFINIR LE PROPRIETAIRE DES DONNEES ET SA DIVISION ASSOCIEE
    	SET @un_utilisateur='DOMAMIELEC\CRMadmin'
    	SET @id_utilisateur='50F3DA06-2E90-DB11-996E-0015E9F01122'
    	SET @businness_unit='CA227FFA-2D90-DB11-996E-0015E9F01122'
     
    --TANT QUE LE CURSEUR CONTIENT DES DONNEES
    WHILE @@FETCH_STATUS = 0
    BEGIN	
    	--INCREMENTATION DE L'IDENTIFIANT
    	SET @identifiant_client=@identifiant_client+1 
     
    --MISE A JOUR DANS LES TABLES DE LA CRM
     
    UPDATE AMIELEC_MSCRM.dbo.AccountBase
    SET AccountCategoryCode=@catcomptaInt,TerritoryId=@conv_pays,DefaultPriceLevelId=@id_tarif,
    OwningUser=@id_utilisateur,AccountNumber=@numpayeur,Description=@intitule,WebSiteURL=@site,EMailAddress1=@mail,
    Telephone1=@telephone,Fax=@fax,ParentAccountId=@idnom_parent,StatusCode=1,StateCode=0,DeletionStateCode=0
    WHERE Name=@Num 
    --Print('maj AccountBase du client'+@num)
    --print(@@rowcount)
     
    IF @@rowcount=0
    --INSERTION DANS LES TABLES DE LA CRM
    INSERT INTO AMIELEC_MSCRM.dbo.AccountBase(AccountId,OwningBusinessUnit,AccountCategoryCode,TerritoryId,DefaultPriceLevelId,
    CustomerSizeCode,PreferredContactMethodCode,PreferredAppointmentDayCode,PreferredAppointmentTimeCode,CustomerTypeCode,AccountRatingCode,IndustryCode,TerritoryCode,
    AccountClassificationCode,BusinessTypeCode,OwningUser,OriginatingLeadId,PrimaryContactId,Name,AccountNumber,Revenue,NumberOfEmployees,Description,SIC,OwnershipCode,MarketCap,
    SharesOutstanding,TickerSymbol,StockExchange,WebSiteURL,FtpSiteURL,EMailAddress1,EMailAddress2,EMailAddress3,Telephone1,DoNotPhone,DoNotFax,DoNotEMail,DoNotSendMM,DoNotPostalMail,DoNotBulkEMail,DoNotBulkPostalMail,
    Telephone2,Fax,Telephone3,CreditLimit,CreditOnHold,ParentAccountId,StatusCode,StateCode,DeletionStateCode)
    VALUES(NEWID(),@businness_unit,@catcomptaInt,@conv_pays,@id_tarif,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,@id_utilisateur,
    NULL,NULL,@num,@numpayeur,NULL,NULL,@intitule,NULL,NULL,NULL,NULL,NULL,NULL,@site,NULL,@mail,NULL,NULL,@telephone,0,0,0,0,0,0,NULL,NULL,@fax,NULL,NULL,NULL,@idnom_parent,1,0,0)
    --Print('insert AccountBAse du client'+@num)
    --print(@@rowcount)
     
    UPDATE AMIELEC_MSCRM.dbo.AccountExtensionBase
    SET New_Identifiant=@identifiant_client,New_TypePersonne=@type_pers_char,New_categorie_comptable=@catcomptaChar,
    New_representant=@un_representant,New_contacts=@contact,New_descriptif=@intitule
    WHERE New_societe=@Num
    --Print('maj Extension BAse du client'+@num)
    --print(@@rowcount)
     
    IF @@rowcount=0
    INSERT INTO AMIELEC_MSCRM.dbo.AccountExtensionBase(AccountId,New_Identifiant,New_TypePersonne,New_categorie_comptable,New_representant,New_prenom_representant,New_nom_representant,New_contacts,New_societe,New_descriptif)
    VALUES(NEWID(),@identifiant_client,@type_pers_char,@catcomptaChar,@un_representant,NULL,NULL,@contact,@num,@intitule)
    --Print('insert Extension BAse du client'+@num)
    --print(@@rowcount)
     
    UPDATE AMIELEC_MSCRM.dbo.CustomerAddressBase
    SET Name=@adresse,Line1=@complement,PostalCode=@code_postal,City=@ville,ObjectTypeCode=1,DeletionStateCode=0,AddressNumber=1
    WHERE Telephone1=@telephone
     
    IF @@rowcount=0
    INSERT INTO AMIELEC_MSCRM.dbo.CustomerAddressBase(Name,Line1,PostalCode,City,ObjectTypeCode,DeletionStateCode,CustomerAddressId,ParentId,AddressNumber)
    VALUES(@adresse,@complement,@code_postal,@ville,1,0,NEWID(),NEWID(),1)
     
    FETCH NEXT FROM un_curseur INTO @id, @num, @numpayeur, @intitule, @contact, @adresse, @complement, @code_postal, @ville, @pays, @telephone, @fax, @mail, @site, @catcomptaInt, @type_personne, @un_tarif,@un_representant
    END
    --FERMETURE ET DESALLOCAION DU CURSEUR
    CLOSE un_curseur
    DEALLOCATE un_curseur
    GO

Discussions similaires

  1. Procedure stockée + insert update
    Par chouchou83 dans le forum Langage SQL
    Réponses: 5
    Dernier message: 20/06/2008, 13h51
  2. UPDATE/INSERT sur des colonnes
    Par baltagi dans le forum Langage SQL
    Réponses: 3
    Dernier message: 02/02/2007, 17h54
  3. Procedure avec INSERT et champ variable
    Par bbshadoks dans le forum MS SQL Server
    Réponses: 6
    Dernier message: 04/12/2006, 10h14
  4. [trigger] update inserted?
    Par cosminutza dans le forum MS SQL Server
    Réponses: 5
    Dernier message: 01/06/2005, 09h37
  5. Evenement sur UPDATE, INSERT, DELETE
    Par papouAlain dans le forum Langage SQL
    Réponses: 6
    Dernier message: 23/12/2004, 14h58

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo