Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.


    • CommentAuthorpreston9
    • CommentTimeNov 4th 2006
     
    When I try to create the stored procedure below, I receive the following error. Can someone please let me know what is wrong with the code? The problem seems to be with the default parameter of getdate(). This is because when I comment the default parameter, it works fine. Please note that I need the @BeginDate parameter to be varchar(10). I cannot have it as datetime.

    Msg 156, Level 15, State 1, Procedure test, Line 4
    Incorrect syntax near the keyword 'convert'.
    Msg 137, Level 15, State 2, Procedure test, Line 8
    Must declare the scalar variable "@BeginDate".
    • CommentAuthorbradley9
    • CommentTimeNov 4th 2006
     
    1). You are not enclosing your parameter declaration in parenthesis.
    2). You appear to be trying to assign a value to the parameter while you are defining it.
    3). Your procedure is probably superfluous, because SQL Server implicit converts datetime and varchar datatypes.

    You need to review the Books Online syntax for stored procedures and parameter declarations. Then you need to clearly define the purpose of this code.
    • CommentAuthorpreston9
    • CommentTimeNov 4th 2006
     
    I mentioned in the issue that I cannot have the parameter as datetime. It is getting used in a report where all the date parameters need to be in varchar data type.