Bonjour,

j'aimerai pouvoir ajouter une colonne à une table en fonction du nom d'un champs.

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
declare @ActionID uniqueidentifier
declare cSeg cursor dynamic
for select ActionID from admAction where ProductIDfk = @ProductID
open cSeg
fetch next from cSeg into @ActionID
while (@@fetch_status = 0)
	begin
 
		declare @NameAction varchar(50)
		select Name = @NameAction from admAction where admAction.ActionID = @ActionID
 
		alter table tmpReporting add @NameAction int
 
	fetch next from ActionID into @ActionID
	end
 
close cSeg
deallocate cSeg
Mais j'ai cette erreur là :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Incorrect syntax near '@NameAction'.
Y-a-t'il moyen ?

Merci.