After executing a stored procedure, I get the following error: 

> 
> Msg 512, Level 16, State 1, Procedure sp\_ActFTC, Line 64  
> 
>  Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. 
> 
> 
> 

I have two tables in the database, `FTC_Alt` and `FichaTecnicaComp`, and I need to update the `FichaTecnicaComp` table on a given date.

```
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[sp_ActFTC] 
AS
    DECLARE @Codigo NVARCHAR(20),
            @DataAlteracao  DATE,
            @Categoria NVARCHAR(20),
            @catord INT,
            @SubCategoria NVARCHAR(255),
            @subcatord INT,
            @Ordem INT,
            @CodigoComp NVARCHAR(10),
            @DesignacaoComp NVARCHAR(50),
            @QuantidadeComp NVARCHAR(25),
            @UnidadeComp NVARCHAR(5),
            @intRowCount INT,
            @upAction NVARCHAR(255);

    SELECT @Codigo = ft_alt.codigo   
    FROM ft_alt;

    SELECT @DataAlteracao = ft_alt.dataalteracao  
    FROM ft_alt;

    SELECT Categoria = ftc_alt.categoria
    FROM ftc_alt;

    SELECT catord = ftc_alt.catord
    FROM ftc_alt;

    SELECT SubCategoria = ftc_alt.subcategoria
    FROM ftc_alt;

    SELECT subcatord = ftc_alt.subcatord
    FROM ftc_alt;

    SELECT Ordem = ftc_alt.ordem
    FROM ftc_alt;

    SELECT CodigoComp = ftc_alt.codigocomp
    FROM ftc_alt;

    SELECT DesignacaoComp = ftc_alt.designacaocomp
    FROM ftc_alt;

    SELECT QuantidadeComp = ftc_alt.quantidadecomp
    FROM ftc_alt;

    SELECT UnidadeComp = ftc_alt.unidadecomp
    FROM ftc_alt;

    SELECT @intRowCount = @@RowCount;

    SET @upAction = 'Composição nutricional actualizada/alterada'
BEGIN
    IF (@DataAlteracao = (SELECT CONVERT(DATE, GETDATE())))
    BEGIN
        SET NOCOUNT ON 

        UPDATE [dbo].[FichaTecnicaComp]
        SET [Codigo] = @Codigo,
            [DataAlteracao] = @DataAlteracao,
            categoria = ftc_alt.categoria,
            catord = ftc_alt.catord,
            subcategoria = ftc_alt.subcategoria,
            subcatord = ftc_alt.subcatord,
            ordem = ftc_alt.ordem,
            codigocomp = ftc_alt.codigocomp,
            designacaocomp = ftc_alt.designacaocomp,
            quantidadecomp = ftc_alt.quantidadecomp,
            unidadecomp = ftc_alt.unidadecomp
        FROM [dbo].[FichaTecnicaComp] 
        JOIN ftc_alt ON [dbo].[FichaTecnicaComp].[Codigo] = (SELECT ft_alt.codigo
                                                             FROM ft_alt)
                     AND [dbo].[FichaTecnicaComp].Ordem = (SELECT FTC_Alt.Ordem
                                                           FROM FTC_Alt)
    END
END  

```

he expected result is that data in `FichaTecnicaComp` is updated from `FTC_Alt`.
Which doesn't happen.

It should be noted that the `FichaTecnicaComp` has the following working triggers: insertion, update and delete.

If you need the code of those triggers just ask.