[procédure stockée][SQL server]Extraction, réinsertion
Bonjour,
Je désire faire une procédure stockée afin de récupérer certaines données d'une table et les réinserer dans une autre table avec une propriété en plus.
J'ai testé cela mais ça ne marche pas :(
Code:
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
|
IF EXISTS (TABLE ETATSANTE)
DROP TABLE ETATSANTE
GO
CREATE PROCEDURE EtatSante
AS
CREATE TABLE ETATSANTE
(
uccleunik integer,
l0cleunik integer,
parentcleunik integer,
etatpc integer
)
SELECT uc.uccleunik, uc.l0cleunik, parentcleunik INTO ETATSANTE (uc.uccleunik, uc.l0cleunik, parentcleunik, '1')
FROM uc, localisa where uc.ram > 128 and uc.l0cleunik = localisa.l0cleunik
SELECT uc.uccleunik, uc.l0cleunik, parentcleunik INTO ETATSANTE (uc.uccleunik, uc.l0cleunik, parentcleunik, '2')
FROM uc, localisa where uc.ram <64 and uc.l0cleunik = localisa.l0cleunik
SELECT uc.uccleunik, uc.l0cleunik, parentcleunik INTO ETATSANTE (uc.uccleunik, uc.l0cleunik, parentcleunik, '3')
FROM uc, localisa where uc.ram < 128 and uc.ram > 64 and uc.l0cleunik = localisa.l0cleunik |