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
|
create PROCEDURE ps_c_Tempo
@totalindice integer,
@indice integer
as
declare @S varchar(5000)
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Tempo]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
DROP TABLE Tempo
set @S='CREATE TABLE [Tempo] (
[Id_Profil] [int] NOT NULL ,
[Id_Intervenant] [int] NOT NULL ,
[Id_Domaine] [int] NOT NULL ,
[Id_Item] [int] NOT NULL ,'
while @indice<=@totalindice
begin
set @S=@S+'[Item'+convert(varchar(3),@indice)+'] [varchar] (30) COLLATE French_CI_AS NOT NULL ,
[Duree_Experience'+convert(varchar(3),@indice)+'] [int] NOT NULL ,
[Niveau_Competence'+convert(varchar(3),@indice)+'] [int] NOT NULL ,'
set @indice=@indice+1
end
set @S=@S+'CONSTRAINT [PKTempo] PRIMARY KEY CLUSTERED
(
[Id_Profil],
[Id_Intervenant],
[Id_Domaine],
[Id_Item]
) ON [PRIMARY]
) ON [PRIMARY]'
exec (@S) |
Partager