Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A syntax error in a execution
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2000
Application:
Desktop
Divers
Thread ID:
01411318
Message ID:
01411320
Vues:
39
>I triedn to execute teh following code:
>
>
>DECLARE trabajador_cursor CURSOR
>   FOR
>   SELECT cod_emple FROM plplfmae WHERE condicion = 'ON'
>OPEN trabajador_cursor
>DECLARE @codigotrabajador varchar
>FETCH NEXT FROM trabajador_cursor INTO @codigotrabajador
>WHILE (@@FETCH_STATUS <> -1)
>BEGIN
>
>   EXEC ('PA_calculorem' @param1 = @codigotrabajador)
>   FETCH NEXT FROM trabajador_cursor INTO @codigotrabajador
>END
>
>
>DEALLOCATE trabajador_cursor
>
>
>
> and i got the following error message:
>
>Servidor: mensaje 170, nivel 15, estado 1, línea 10
>Línea 10: sintaxis incorrecta cerca de '@param1'.
>
>Anyone can help me to find what i did wrong?
>Thank you

You can use

EXECUTE PA_calculorem @param1 = @codigotrabajador

and make sure to declare your varchar parameter with the proper size.

See also How to return a value from dynamically executed T-SQL code FAQ #8130 for syntax details.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform