0
I have a stored precedent to change a field of tables of varied name:
CREATE PROCEDURE usp_alterarCrachaCadAce
--PARÂMETROS
@NomeTabela VARCHAR(20),
@CrachaDestino FLOAT,
@CrachaOrigem FLOAT
AS
BEGIN
Declare @Comando Varchar(1000)
Set @Comando = 'UPDATE '+@NomeTabela +' SET ace_ cracha = '+@CrachaDestino+ ' WHERE ace_cracha = '+@CrachaOrigem
Exec(@Comando)
END
however it is giving an error that I did not understand very well when running the sp:
Mensagem 8114, Nível 16, Estado 5, Procedimento usp_alterarCrachaCadAce,
Linha 17
Erro ao converter tipo de dados varchar em float.
OBS: the data being passed is DOUBLE, but I did not find any way to declare double in SQL, so I understood I should use the same float.
Related: Concatenate columns in SQL SERVER .
– Sorack