Syntax error

  • I tried to excute a stored procedure, but it gives the sysntax error on the last line

    EXECUTE @rc = [Assignment].[dbo].[sps_schSchoolRangeProgram_Insert]

    @SchoolYear=2012

    ,@SchoolID=972

    ,@RangeCd='PS'

    ,@ProgramID=29

    ,@CreatedBy=SYSTEM_USER

    Incorrect syntax near the keyword 'System_User'.

    What could be wrong? if I change a specific username, it is correct.

  • You cannot use Functions as direct input parameters. Initialize it to a variable and use it as an input parameter

  • Can you please make an example?

    Thanks

  • here

    Use tempdb

    GO

    create proc getsthedate @dateval datetime

    as

    select @dateval ;

    GO

    declare @d datetime = getdate()

    exec getsthedate @dateval = @d;

    exec getsthedate @dateval = getdate() ;

    drop proc getsthedate;

  • Another option would be to have SYSTEM_USER as the default for the column.

  • Thank you all!

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply