Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A syntax error in a execution
Message
 
 
To
09/07/2009 20:32:59
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2000
Application:
Desktop
Miscellaneous
Thread ID:
01411318
Message ID:
01411320
Views:
38
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform