Simple question: why does the top statement work, but the bottom one fails with
‘Incorrect syntax near (‘
Code:
USE [Research]
GO
DECLARE @d datetime
SELECT @d = GETUTCDATE()
DECLARE @return_value int
EXEC @return_value = [MyApp].[DateStamp]
@date = @d
SELECT 'Return Value' = @return_value
GO
This one fails:
USE [Research]
GO
DECLARE @return_value int
EXEC @return_value = [MyApp].[DateStamp]
@date = GETUTCDATE()
SELECT 'Return Value' = @return_value
GO
DateStamp is a proc that writes a bunch of stuff to a time dimension, like financial year, quarter etc.
Thanks.
Assigning values to parameters in EXECUTE must be a value a variable or
DEFAULT.GETUTCDATE()is an expression that needs to be evaluated.