views:

146

answers:

1

Maybe I am having a moment of 'afternoon', but can anyone explain why I get

Msg 102, Level 15, State 1, Line 2 Incorrect syntax near ')'.

When running

CREATE PROC DisplayDate 
(
@DateVar DATETIME
) AS 
BEGIN
SELECT @DateVar
END

GO

EXEC DisplayDate GETDATE();
+7  A: 

You can't pass in a function call as a argument to your stored procedure:

DECLARE @tmp DATETIME
SET @tmp = GETDATE()

EXEC DisplayDate @tmp;
Mitch Wheat