Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql - Insert
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01140319
Message ID:
01140360
Vues:
15
>Yes, that is the idea.
>
>But all three tables are in Sql Server.

Then you must create a trigger as Jake said, or SP wich will handle this for you., something like:
CREATE PROCEDURE InsertIntoTable3
@Description as varchar(8000) = ''
AS
BEGIN
     DECLARE @lcCode1 AS char(5)
     DECLARE @lcCode2 AS char(5)
     DECLARE @lnError AS int
     BEGIN TRANSACTION
        UPDATE TABLE1 SET @lcCode1 = Code1 = CAST(CAST(Code1 as int)+1 as char(5))
        @lnError = @@ERROR
        IF @lnError = 0
           BEGIN
               UPDATE TABLE2 SET @lcCode2 = Code2 = CAST(CAST(Code2 as int)+1 as char(5))
               @lnError = @@ERROR
               IF @lnError = 0
                  BEGIN
                      INSERT INTO Table3 VALUES (@lcCode1, @lcCode2, @Description)
                      @lnError = @@ERROR
                  END
           END
      IF @lnError = 0
         COMMIT
      ELSE
         ROLLBACK
END
(not tested)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform