• Senchi - Tuesday, January 2, 2018 7:19 PM

    CREATE PROCEDURE sp_cenik
    as begin

    DECLARE
    @OD DATETIME,
    @DO  DATETIME,
    @TipSobe VARCHAR(6),
    @KodaCenika  INT,
    @Sezona   INT

    SELECT
    @Od = :a2,
    @Do  = :a3,
    @TipSobe = :a1,
    @KodaCenika = :a4;

    I get:
    "Msg 102, Level 15, State 1, Procedure sp_cenik, Line 18
    Incorrect syntax near ':'.

    What am I doing wrong ?   These are parameters.

    If they are, in fact, parameters as you say, then that's the wrong way to pass parameters in a stored procedure.  Please see the following...
    https://docs.microsoft.com/en-us/sql/t-sql/statements/create-procedure-transact-sql

    Parameters look like variables that begin with @.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)